-
Notifications
You must be signed in to change notification settings - Fork 18
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
Loading from the storage does not overwrite initial state completely #4
Comments
AFAIK the load give you the state, so it's up to you to write a reducer to update the current state created by the create store. I have also try a different workaround: Put a fake store to call the loader, then init the store and pass the persisted state as an 'initial state'. Because it's the first time I'm using it, I'm not sure this is the way to go, but nothing in the load state API is written to update the current state. Just remember to call load the store should exists so there is already a state. |
I came across the same issue @georgjaehnig and I've also expected that the state will be overwritten. And I also don't know if it's a lack of understanding or just a bug :D But looks more likely like the second one. @jmfrancois If the |
+1, this is very confusing. The previous version this was forked from definitely loaded the stored state upon calling |
Actually, my issue is that when I try to introduce |
It's working for me, including redux devtools. My setup in case anyone's interested:
|
I was having the same issue, but found it to be a copy/paste mistake. I missed/overlooked/forgot to add the reducer created by One other issue I've found that you want to be careful of, if you persist complex objects for instance Moment, you will need to handle the LOAD event in your reducer and convert it to an object. You can also probably do this using the optional parameters |
Hi, it seems that loading from the storage does not overwrite the initial state completely, and that looks like a bug for me. ( If it's not, please tell me how I can work with it productively. :) )
An example: Let's say, this is my initial state:
Then, in some dispatch, I change the value of test:
With redux-storage set up, this is saved (I guess).
When I now close/reopen or reload the whole app, I have this state:
I think, there should be no
foo: 1
at this point, should it?At least it's bugging me in my app, so what's the correct way of getting rid of it? Is there a config option for
redux-storage
that I can set?(See the whole code here.)
The text was updated successfully, but these errors were encountered: