Closed ntucker closed 8 years ago
My redux receives this action
{type: "persist/REHYDRATE", payload: { counter: 3}, error: null}
But there is zero change in the store state.
You should not need action buffer for this to work. Are you using hot module reloading or webpack code splitting?
If you log inside of stateReconciler you see it execute once for the @@INIT action and not thereafter?
I am using both hot module reloading as well as code splitting.
If you log inside of stateReconciler you see it execute once for the @@INIT action and not thereafter?
This was true before, I'll double check that it is still only happening once.
so this may be related to either hmr or code splitting. autorehydrate skips keys that are not found in initialState, so this may be part of the problem. One simple thing that might help us debug is to add logging to autoRehydrate: autoRehydrate({log: true})
Hmm...strange. I nuked the node_modules and it's loading counter now.
However, now trying more complex things an encoded map is not working. I'll have to trace down if it's not saving it or not here, but it shows up as an empty map in my payload for the autorehydrate action.
...Ok, doesn't seem to be saving successive stuff. My counter is just loading at 3 each time so I guess that's why the map is empty.
log: true doesn't seem to be adding any output to console. Is this scoped under debug, if so what wildcard should I turn on to see it?
Turns out I had some issue with npm dependency and need to nuke even more stuff.
Out of curiosity, what does this mean:
redux-persist/autoRehydrate: 1 actions were fired before rehydration completed. This can be a symptom of a race
condition where the rehydrate action may overwrite the previously affected state. Consider running these actions
after rehydration:
reconciler.js?96d7:31redux-persist/autoRehydrate: key `auth`, rehydrated to undefined
reconciler.js?96d7:31redux-persist/autoRehydrate: key `counter`, rehydrated to undefined
PS) Thanks for humouring me while I fixed up module setup!
nice!
the "1 action fired before rehydration completed" means an action fired before the REHYDRATE action, and its possible whatever state was set will have been subsequently overidden by the rehydration. In this case it may actually be the redux @@INIT action in which case there is no problem.
Hmm, maybe you should not print message for @@INIT as that will always happen then?
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?
As mentioned: https://github.com/rt2zz/redux-persist/pull/113#issuecomment-243931005 and https://github.com/rt2zz/redux-persist/issues/165