-
Notifications
You must be signed in to change notification settings - Fork 109
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
Using fetchPolicy: 'cache-and-network' creates infinite loop #13
Comments
The infinite loop is caused by suspense. A component using the I also added a workaround in db119e5. You can now invoke the hook as |
@trojanowski what's the reason it ignores the local cache? Is that a bug in |
The infinite look was caused because:
We should be able to emulate I'm going to close this issue because the loop doesn't happen in the non-suspense mode, and it's not currently possible to use it with |
I've made a rewrite of your useQuery hook and it works with any fetchPolicy, you can check it here https://github.com/nicolaslopezj/apollo-hooks/blob/master/src/useQueryBase.js |
@trojanowski Do you think the changes @nicolaslopezj can be merged? |
@trojanowski the changes was merged? or any support was added for this? |
Using the options
cache-and-network
for fetch policy creates an infinite loop.I could see that in this
if
:previousVariables.current
andpreviousRestOptions.current
and always undefined.I don't know why useRef is not persisting.
The text was updated successfully, but these errors were encountered: