Problem/Motivation
This is a continuation of Github issue #1351: Using the current_user data producer makes response uncacheable.
When using the current_user data producer the response becomes uncacheable. This is because of this line:
$field_context->addCacheableDependency($this->currentUser);
As $this->currentUser is an AccountProxy object which does not implement CacheableDependencyInterface, the addCacheableDependency() method in RefinableCacheableDependencyTrait will fall back to setting the max age to 0.
Proposed resolution
Add the user cache context manually.
Issue fork graphql-3552851
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pfrenssenComment #4
pfrenssenComment #5
klausiPerfect, thanks a lot!