fix(dataproducer): CurrentUser result is uncacheable#1417
Closed
pfrenssen wants to merge 3 commits intodrupal-graphql:8.x-4.xfrom
Closed
fix(dataproducer): CurrentUser result is uncacheable#1417pfrenssen wants to merge 3 commits intodrupal-graphql:8.x-4.xfrom
pfrenssen wants to merge 3 commits intodrupal-graphql:8.x-4.xfrom
Conversation
klausi
requested changes
Aug 30, 2024
Contributor
klausi
left a comment
There was a problem hiding this comment.
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
| label: "GraphQL Settings" | ||
| mapping: | ||
| # @todo Remove in GraphQL 5. | ||
| dataproducer_allow_current_user_caching: |
Contributor
There was a problem hiding this comment.
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 = []) { |
Contributor
There was a problem hiding this comment.
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.
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1351