-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
How do I know when persist finishes saving changes? #454
Comments
Hey @shoeman22, Yep, there is actually an undocumented API for this case. This was an oversight and likely I need to drop in the TypeScript definitions too. Try doing the following prior to a redirect: await store.persist.flush();
window.location.href = "http://winning.com"; 👍 |
You can use the |
FYI @shoeman22 This doesn't actually work as expected. No promise is returned. But I will extend the API to do so. I'll also add typing information and documentation on them. 👍 |
@shoeman22 the latest alpha of 3.4.0 now includes these APIs in terms of documentation and TypeScript typing. I have also added a test case to ensure that the I would appreciate it if you could try it out and feedback. Details of the alpha are on #459 |
On my logout flow, I want to clear the state so I have my model setup like:
Then in my app I do something like:
I think I need some way to wait for the persist action to complete before I do my redirect because I don't think it's getting saved into sessionStorage (I still see authentication token in my store after I redirect).
Is there a good way to accomplish this?
The text was updated successfully, but these errors were encountered: