createBatchingNetworkInterface causing issues with client.resetStore()
See original GitHub issueWhen using regular createNetworkInterface
, if I skip
all my active queries (I’m using react-apollo
) and run client.resetStore()
, everything works fine.
Switching over to createBatchingNetworkInterface
, running the same code causes:
Unhandled Promise Rejection (id: 0):
Error: Network error: Store reset while query was in flight.
If I stick client.resetStore()
inside a timeout, this issue goes away, which leads me to believe it’s some sort of timing issue for stopping queries. That said, redux devtools shows all the queries stop (APOLLO_QUERY_STOP
) before APOLLO_STORE_RESET
executes.
Small issue because it goes away with a quick fix, but not intended behavior
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Unhandled error: Store reset while query was in flight. #1945
error. In our applyAfterware method we are handling 401 errors, logging out the user and calling the client.resetStore method. It can happen ...
Read more >clearStore() vs resetStore() - Help - Apollo GraphQL
resetStore() after your login or logout process has completed. This will cause the store to be cleared and all active queries to be...
Read more >How to use the apollo-client.createBatchingNetworkInterface ...
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >Reset store after logout with Apollo client - Stack Overflow
If you need to clear your cache and don't want to fetch all active queries you can use: client.cache.reset(). client being your Apollo ......
Read more >Authentication - Client (React) - Apollo GraphQL Docs
resetStore() after your login or logout process has completed. This will cause the store to be cleared and all active queries to be...
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 FreeTop 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
Top GitHub Comments
Keep in mind that
client.resetStore()
is async, and returns a promise. So you might get issues if you don’t await and immediately follow it by a redirect to a page with queries on it.This issue has been automatically closed because it has not had recent activity after being marked as stale. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to Apollo Client!