-
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
watchQuery defaultOptions are unset when query variables change (specifically nextFetchPolicy) #6839
Comments
This does seem important, and not just for |
@benjamn Hi, I hate to be the person to post a "+1 me too", but this issue has been out here for 8 months now and is still a problem. It looks like @jebonfig has updated their reproduction to use the new |
Despite my vague suggestion in the removed comments that deleting options.nextFetchPolicy somehow helped make the fetchPolicy transition idempotent (a concern that only matters when nextFetchPolicy is a function), leaving options.nextFetchPolicy intact should also be safe/idempotent in virtually all cases, including every case where nextFetchPolicy is just a string, rather than a function. More importantly, leaving options.nextFetchPolicy intact allows it to be applied more than once, which seems to fix issue #6839.
Despite my vague suggestion in the removed comments that deleting options.nextFetchPolicy somehow helped make the fetchPolicy transition idempotent (a concern that only matters when nextFetchPolicy is a function), leaving options.nextFetchPolicy intact should also be safe/idempotent in virtually all cases, including every case where nextFetchPolicy is just a string, rather than a function. More importantly, leaving options.nextFetchPolicy intact allows it to be applied more than once, which seems to fix issue #6839.
Despite my vague suggestion in the removed comments that deleting options.nextFetchPolicy somehow helped make the fetchPolicy transition idempotent (a concern that only matters when nextFetchPolicy is a function), leaving options.nextFetchPolicy intact should also be safe/idempotent in virtually all cases, including every case where nextFetchPolicy is just a string, rather than a function. More importantly, leaving options.nextFetchPolicy intact allows it to be applied more than once, which seems to fix issue #6839.
@jebonfig Please try |
Thanks @benjamn! This is fixed on |
Intended outcome:
The
defaultOptions.watchQuery.nextFetchPolicy
setting should always be applied for the query, even if the query variables change. I am setting it tocache-only
to retain the behavior from #6353Actual outcome:
When the query variables change, the
defaultOptions
are unset. This results in unexpected network calls after cached data changes.How to reproduce the issue:
Simple repro here: https://github.com/jebonfig/react-apollo-error-template
Versions
The text was updated successfully, but these errors were encountered: