-
Notifications
You must be signed in to change notification settings - Fork 117
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
Calling client.clearStore() does not reset the persistence layer #504
Comments
The eventually could be the key here. To forcefully clear the storage, call apollo-cache-persist/examples/web/src/App.tsx Lines 100 to 105 in 405de6f
|
Okay, that makes sense, but I think it would be helpful if the FAQ mentioned this detail. Its very easy to read that FAQ, come away with the impression that the persistence is purged on A variant that seems to work well for me is: useEffect(() => {
return client.onClearStore(async () => {
await persistor.purge();
});
}, []); I think most would expect this to be the default behavior. In fact, is there actually a use-case for not purging when the store is cleared? |
I'm not aware of such use-case. The only reason I could think of is that purging might be an IO heavy task which could block the main thread, and the app might look frozen once the user taps on sign-out button. I see your point though, it's definitely a tricky situation with non-obvious behaviour. Would you mind submitting a PR rewording the FAQ? |
What if i have a external logout hook, like this one:
How can you export the persistor from the initial config that looks like this:
|
The FAQ states:
This does not appear to work. Data remains in
AsyncStorage
, and is restored bypersistCache()
.The text was updated successfully, but these errors were encountered: