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.

createBatchingNetworkInterface causing issues with client.resetStore()

See original GitHub issue

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

github_iconTop GitHub Comments

2reactions
jaydensericcommented, Jun 23, 2017

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.

0reactions
stale[bot]commented, Aug 30, 2017

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!

Read more comments on GitHub >

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

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