-
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
[v3.4 Regression] Changing variables uses nextFetchPolicy instead of fetchPolicy #8426
Comments
@brainkim I thought it was interesting that #7437 is happening in v3.3 whereas I only saw my issue in v3.4. I played around a little and I was able to get the issue to happen in v3.3 if |
@dylanwulf The operative change in apollo-client/src/react/data/QueryData.ts Line 203 in f11a163
Calling applyNextFetchPolicy here advances immediately to nextFetchPolicy without ever using fetchPolicy , which seems incorrect to me. Removing this line fixes the reproduction you provided, though you might want to remove notifyOnNetworkStatusChange: true from your useQuery options to avoid receiving intermediate loading: true results with cache data.
On a more general note, since you mentioned #6839, I have to admit I'm not comfortable with the role |
@benjamn thanks for looking into this! awesome to hear you found the root cause
When I change the variables, I seem to be receiving intermediate
I agree, I think that when the variables change it should use the Between #6839 and #8426 (comment), |
@dylanwulf I looked into this, and it seems to be a consequence of using React When using For what it's worth, we are actively rethinking these issues with |
Oooh ok that makes sense, thank you for the explanation |
Alright, except for the weirdness about |
Intended outcome:
I have a query with
fetchPolicy: 'network-only'
andnextFetchPolicy: 'cache-first'
. When I change the variables, it should fetch new results from the server regardless of what's in the cache.Actual outcome:
Changing the variables appears to use the
nextFetchPolicy
and does not fetch new data from the server.How to reproduce the issue:
https://github.com/dylanwulf/react-apollo-error-template/tree/changing-variables-nextFetchPolicy
Please use branch
changing-variables-nextFetchPolicy
.Reproduction instructions: Open dev tools and watch the console. Click any of the unselected radio buttons, see that a request to the server is made (this is printed to the console instead of the network tab due to the apollo link). Click "All", see that a request to the server is NOT made.
It looks like this problem first showed up in
v3.4.0-rc.5
and still exists inv3.4.0-rc.14
The text was updated successfully, but these errors were encountered: