-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dataproducer): CurrentUser result is uncacheable #1417
base: 8.x-4.x
Are you sure you want to change the base?
fix(dataproducer): CurrentUser result is uncacheable #1417
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, approach makes sense. Only the test is not correct to me.
Please continue this work in a new merge request on drupal.org, we recently moved development there to assign issue credits there. https://www.drupal.org/project/issues/graphql
@@ -72,6 +72,11 @@ graphql.settings: | |||
label: "GraphQL Settings" | |||
mapping: | |||
# @todo Remove in GraphQL 5. | |||
dataproducer_allow_current_user_caching: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this setting. We can add caching, as long as we achieve the same behavior this will not be a compatibility break.
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function executeDataProducer($id, array $contexts = []) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but this does not actually test the caching.
We need to test 2 things:
- Repeated calls to get the current user return a cached result
- when the user cache context is cleared you get an uncached result
I think just calling the dataproducer is not enough. Check out ResultCacheTest which does some unholy mocking, but should be the right approach.
Fixes #1351