apollo.resetStore()
hangs forever on the second time it's called and throws Store reset while query was in flight(not completed in link chain)
errors on successive calls.
It might be related to https://github.com/apollographql/apollo-client/issues/2919
live: https://resetstore-bug-khorpkwmii.now.sh
source: https://github.com/zvictor/bug-resetStore
[email protected]
as both email and pass 😉)Store reset while query was in flight(not completed in link chain)
error will be thrown.Commenting out Network
at components/MeBox.js:39
makes the bug disappear.
This issue only occurs when there are nested queries in the page.
The MeBox
component contains a Query
that will render the Network
component once the user data is loaded. Inside Network
there is also a Query
, and that seems to be the origin of the error.
Versions
System:
OS: macOS High Sierra 10.13.4
Binaries:
Node: 8.11.2 - ~/.nvm/versions/node/v8.11.2/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.1.0 - ~/.nvm/versions/node/v8.11.2/bin/npm
Browsers:
Chrome: 66.0.3359.181
Safari: 11.1
npmPackages:
apollo-boost: ^0.1.7 => 0.1.7
apollo-link-context: ^1.0.8 => 1.0.8
react-apollo: ^2.1.4 => 2.1.4
This issue is related to https://github.com/apollographql/apollo-client/issues/3766, https://github.com/apollographql/apollo-client/issues/3792 and https://github.com/apollographql/apollo-client/issues/2919. We'll address them all in one shot.
I am also seeing this issue ...
@hwillson - Hi there. Is there an expected date for this to be fixed? or is there any workaround for now?
Thanks
Here's a workaround I've found:
client.cache.reset();
await client.reFetchObservableQueries();
Unfortunately neither of these functions are documented so I don't feel comfortable depending on this long-term. I also wonder what would happen if you ran this while there actually _were_ queries in flight. Probably a nasty race condition, but still better than the current behavior of just failing with an error if there are nested queries anywhere on the page.
I'd also like to hear an update on the status of this, as it's been four months since the last official comment and this one just cost me half a day of work...
Thanks for reporting this. There hasn't been any activity here in quite some time, so we'll close this issue for now. If this is still a problem (using a modern version of Apollo Client), please let us know. Thanks!
Most helpful comment
Here's a workaround I've found:
Unfortunately neither of these functions are documented so I don't feel comfortable depending on this long-term. I also wonder what would happen if you ran this while there actually _were_ queries in flight. Probably a nasty race condition, but still better than the current behavior of just failing with an error if there are nested queries anywhere on the page.
I'd also like to hear an update on the status of this, as it's been four months since the last official comment and this one just cost me half a day of work...