Skip to content
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

Prevent fragments from impacting @client fields #4483

Closed
wants to merge 1 commit into from

Conversation

hwillson
Copy link
Member

In the LocalState.resolveSelectionSet method, we’re adding the rootValue to the resultsToMerge array multiple times. This is causing issues when a @client query, that also includes fragments, is run. If the @client field is configured to use a local resolver, when the result is calculated and returned from the local resolver, the fragment results are then merged with the result, along with another copy of the rootValue. The second copy of the rootValue overrides the value received from the @client local resolver.

This PR moves the merging of the rootValue up a level, so it only happens once, and doesn’t override local resolver results.

In the `LocalState.resolveSelectionSet` method, we’re adding the
`rootValue` to the `resultsToMerge` array multiple times. This
is causing issues when a `@client` query, that also includes
fragments,  is run. If the `@client` field is configured to use a
local resolver, when the result is calculated and returned from
the local resolver, the fragment results are then merged with the
result, along with another copy of the `rootValue`. The second
copy of the `rootValue` overrides the value received from the
`@client` local resolver.

This commit moves the merging of the `rootValue` up a level, so
it only happens once, and doesn’t override local resolver results.
@hwillson hwillson force-pushed the hwillson/resolver-override-fix branch from b5bafd0 to ec2e7a8 Compare February 22, 2019 23:14
@hwillson
Copy link
Member Author

Closing as the fix for #4474 will cover this as well.

@hwillson hwillson closed this Feb 25, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant