Clearing the client state using 'resetStore'
See original GitHub issueNot sure if this is actually a bug but more of behaviour issue, we use resetStore
to clear the state on user logout. However, active queries on that page are being sent once resetStore
is called.
The queries made require authentication on the backend, so once logout is made they respond with a 401.
I’ve already submitted a PR with a possible solution, just not sure how the apollo team wants to go about it: https://github.com/apollographql/apollo-client/pull/1487
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:6 (3 by maintainers)
Top Results From Across the Web
clearStore() vs resetStore() - Help - Apollo GraphQL
According to the Apollo docs: The easiest way to ensure that the UI and store state reflects the current user's permissions is to...
Read more >Reset store after logout with Apollo client - Stack Overflow
Resets your entire store by clearing out your cache and then re-executing all of your active queries.
Read more >[Solved]-Reset store after logout with Apollo client-Reactjs
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 >Use LibMan with ASP.NET Core in Visual Studio
Menu items for triggering LibMan restore and clean operations. ... Use the Add Client-Side Library dialog; Manually configure LibMan ...
Read more >Importing and exporting SQL Server databases using native ...
There are many additional advantages to using native backup and restore. ... In this case, the database remains in the RESTORING state after...
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
@Poincare also, in the PR I’ve added an option to
resetStore
to be able to not refetch, default behaviour is still to run active queries. PR here: https://github.com/apollographql/apollo-client/pull/1487@oavasilcai #1636 and the PR that references it in react-apollo. It should be shipped in
react-apollo@^1.2.0
.