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.

Clearing the client state using 'resetStore'

See original GitHub issue

Not 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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
oavasilcaicommented, Mar 30, 2017

@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

0reactions
helfercommented, May 4, 2017

@oavasilcai #1636 and the PR that references it in react-apollo. It should be shipped in react-apollo@^1.2.0.

Read more comments on GitHub >

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

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