-
Notifications
You must be signed in to change notification settings - Fork 868
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
Allow for any type of root level state #113
Conversation
awesome 👍 I like this general approach, but want to wait for some resolution to reduxjs/redux#1792 before committing to a specific api. |
OK, cool. In the mean time I have published this PR as redux-persist-2 for anyone that already wants to use it. |
where is reduxPersistImmutable coming from? from redux-persist-transform-immutable? can I have an example? |
|
thanks, so whats the difference between redux-persist-imutable and redux-persist-transform-immutable? github redirects redux-persist-immutable to redux-persist-transform-immutable |
@dpereira411 redux-persist-immutable is deprecated, as redux-persist-transform-immutable works with redux-persist v3+ |
Could i get a little help on this API?
|
|
that'll do it, thanks! |
shouldn't that be |
autoRehydrate doesn't seem to be working
It saves state fine (I checked the store), but it won't initialize. It creates an action properly with all the data, but that doesn't update the state for some reason. I put some console.log in the autorehydrate enhancer and I noticed its reducer is only called once on the @@init action, then never again. It's not called on the persist/REHYDRATE or anything else. Anyone know why that might be? |
@ntucker I ran into a similar issue - basically you have to pass
@rufman may be helpful to add this note to your original comment. Thanks for making this btw! |
Thanks @marcellosachs ! |
Yeah, I guess I need to go over the docs and add that. My bad. |
@ntucker yikes good catch 🙌 |
@rufman @marcellosachs |
The reconciler problem wasn't my issue. The problem is the reducer from createRehydrationReducer is only run once from the @@init action. stateReconciler only matters INSIDE that reducer, but it doesn't even get the chance to run. Maybe this is because I'm not using Action Buffers? PS) I'm using "redux-persist": "3.6.0-alpha1", |
This addresses issue (#64), when you have an immutable object as the root state.
The
redux-persist-immutable-state
package provides the functions for actually iterating over an immutable root state as well as getting and setting keys.Usage of redux-persist-immutable-state:
I've spent some time benchmarking the persisting of new data on state changes, as well as rehydrating the state from localStorage. Here are the results:
The skeleton around those benchmarks is here: https://github.com/rufman/benchmark-redux-persist
If you want to run the tests yourself just clone https://github.com/rufman/redux-persist into the
lib
directory ofbenchmark-redux-persist
and runwebpack
. Thenopen index.html
and run the tests.