question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using fetchPolicy: 'cache-and-network' creates infinite loop

See original GitHub issue

Using 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:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
Yaliancommented, Jul 16, 2019

@trojanowski the changes was merged? or any support was added for this?

6reactions
namnmcommented, May 13, 2019

@trojanowski Do you think the changes @nicolaslopezj can be merged?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found