-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fields not marked with @client are being resolved locally #9571
Comments
I appreciate that local resolvers are being moved out of core and into a link, but this should be addressed regardless of where the implementation lives, thanks |
I've faced the same issue, and it turns out that the presence of a single Here is a benchmark to demonstrate the impact of this issue: https://github.com/vladar/apollo-at-client-bench
Note that the client resolver executes only once for the whole query, but performance degrades significantly. I have a potential fix for this problem, will publish a PR soon. |
Hey @vladar , I finally had time to try your PR and can confirm it fixes the issue. I see the non-client parts only being correctly sent across the link and the client parts only being resolved locally. Thanks for working on this! |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
It is important to be able to precisely control which fields are resolved locally versus remotely while a remote service is developed and incrementally replaces a local implementation. Once a remote service starts offering a field, I want to start removing
@client
from some queries that use that field, without yet removing the local resolver definition.This scenario is not supported today due to a bug.
Intended outcome:
Only fields marked
@client
should be sent to local resolversActual outcome:
If a
@client
directive appears anywhere in a document, local resolvers are looked for and run for all fields in the entire document, regardless of whether those fields were tagged with the@client
directive.How to reproduce the issue:
Have a resolver both locally and on the server for a field. Send a query that does not tag that field with
@client
, but does tag some other field with@client
. Observe that the result for the field not tagged with@client
was supplied by the local resolver, despite the lack of tag.The problem is in the local state code that indiscriminately returns the entire document instead of just stripping out the
@client
parts:Versions
The text was updated successfully, but these errors were encountered: