-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resetStore not clearing store! #1849
Comments
@stantoncbradley thanks for filing the issue along with a reproduction and good description of what's going on. @jbaxleyiii FWIW: I think the data may be cleared in the store, but due to this PR in react-apollo, the query data isn't read from the store, but from here. Maybe |
@helfer no problem! A couple things on further investigation:
Perhaps I am unclear on the intended behavior of For our signout use case, we want to clear the store and clear the data in all of our components. The docs suggest using The current behavior of Since For now we are rolling back to Please let me know your thoughts on this, I'm happy to help resolve. Thanks! |
@stantoncbradley @helfer keeping the data is indeed the intended effect since you may have a mixture of user data and global data. So components showing things that aren't user specific didn't want to re-render until it has new data to show. @stantoncbradley a couple options here:
I'd recommend trying option one (we should document this as well) since both behaviors are valid. Does this help? |
@jbaxleyiii thanks for the suggestion. How do you recommend doing #1? I tried
in my example repo and I'm still not getting empty data thanks! |
@stantoncbradley resetStore returns a promise, can you try the force update after that is done? |
even added a 5 sec delay to my resolver, still not seeing empty data in between fetches
thanks!! |
looking at the code for
I think @helfer is right, this may be an issue with EDIT: |
@stantoncbradley yeah lets move this to the react integration! I'll see if I can come up with a solution! |
Attached to apollographql/react-apollo#807 |
This to me is still a bug. I don't see the point of resetting not resetting anything. This also becomes a problem if you persist the cache, because you do nothing. If you need to use the data, take it out before resetting or provide another method to do it or an argument. The only workaround I found is creating a new client, and if you're persisting the cache, purge before. |
The way Is it possible to provide at least option to not fetch queries? Or clear all queries, even active, so people who know what they do can do this :) |
@stalniy did you find a solution for this? i am facing the same issue, not sure where to go now |
+1 |
client.cache.reset() will actually clear the cache |
Intended outcome:
resetStore clears the Apollo data
Actual outcome:
resetStore only refetches, there is no point where data in components is cleared
How to reproduce the issue:
error repo: https://github.com/stantoncbradley/apollo-reset-store
Our actual use case is a user signing out of our app. We noticed if another user logs in and one of the queries fails, data from the last user displays! It was never cleared!!!!
The text was updated successfully, but these errors were encountered: