Having multiple watchQuery observables on the page causes an inifite number of rapid requests
See original GitHub issuev3.1.x of apollo client introduced an odd issue in our software where having multiple watchQuery
observables on the page causes it to make 10s of http requests per second an infinite number of times.
Intended outcome:
To make a single http request per watchQuery
observable.
Actual outcome: 10s of requests are made to the server per second infinitely.
How to reproduce the issue: I’ve created a minimal reporoduction of the issue, note I’ve mocked the http request but the original issue was happenning with a real backend. https://stackblitz.com/edit/apollo-watch-query-infinite
Versions System: OS: Windows 10 10.0.18363 Binaries: Node: 12.13.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.0 - ~\AppData\Roaming\npm\yarn.CMD npm: 6.12.1 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 81.0.4044.92 Edge: Spartan (44.18362.449.0)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top GitHub Comments
https://github.com/apollographql/apollo-client/issues/6760#issuecomment-668188727 Here is some more info on something they changed in 3.1. If you set
nextFetchPolicy: 'cache-first'
it will stop.I really think they should have communicated this a bit better, seeing the impact this can have on some servers
Yes, I can confirm this issue but in a little bit different condition: using pollInterval, in case if multiple queries (pollInterval applied) are used on the same page. I have 8 queries (pollInterval applied) on the same page which gives me an infinite querying loop very quickly.