Open claykohut opened 6 years ago
if all you want is to reset state, you should be able to simple dispatch your resetStore
action, then redux-persist will store the reset state as soon as it can.
purge is meant for clearing state explicitly, usually done as part of development when state gets into a bad place.
flush is designed to force the writing of all pending state asap, and to provide a promise to wait for the writes resolution. This can be handy for example if you need to ensure latest state is written before navigating away.
@rt2zz I encounter the same problem. After performing my redux-reset action, my actual redux store reflects the right information. However, after explicitly flushing the persistor and restarting the app, the redux store has the information from before the reset.
I'm trying to clear my app's state and persisted data -- and then do some various action.
Before, I was just doing something like:
But it seems like sometimes if i close the app and reopen quick enough the app will have cleared the store but not saved the new state.
Now i'm doing something like:
This seems like super overkill, so maybe I'm not understanding the point of flush -- does flush force a save on the pending state data? should flush be called before a purge?
If I'm resetting the state of the store and want to make sure the cleared store sticks, do I need to resetStore, then flush, then purge?
Sorry if this is a bit confusing.
Thanks