Using fetchPolicy: 'cache-and-network' creates infinite loop
See original GitHub issueUsing the options cache-and-network for fetch policy creates an infinite loop.
I could see that in this if:
query === previousQuery.current &&
isEqual(variables, previousVariables.current) &&
isEqual(apolloContextOptions, previousApolloContextOptions.current) &&
isEqual(restOptions, previousRestOptions.current)
previousVariables.current and previousRestOptions.current and always undefined.
I don’t know why useRef is not persisting.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Infinite loop when using a cache-and-network fetchPolicy #7436
Intended outcome: I have a component that retrieves some data using useQuery and renders a chart. Until now I used these options: ...
Read more >Infinite loop when using a cache-and-network fetchPolicy
Intended outcome: I have a component that retrieves some data using useQuery and renders a chart. Until now I used these options:
Read more >How to use the react-apollo.useLazyQuery function in ... - Snyk
useLazyQuery examples, based on popular ways it is used in public projects. ... to run this effect only once, otherwise we might end...
Read more >Apollo React client - Query component doesn't reach back end ...
After reading i believe that you want changes in rendered component. ... change the state in wrong way that can lead you ti...
Read more >Pitfalls I fell into during Apollo Client 3.0 migration
With this condition, when any fetchPolicy beside cache-first or cache-only is set as an option we ran into this infinite loop.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@trojanowski the changes was merged? or any support was added for this?
@trojanowski Do you think the changes @nicolaslopezj can be merged?