redux-persist-immutable
redux-persist-immutable copied to clipboard
Handling updates to the format of the reducer that conflicts with local version
Hi! I’m wondering if you have a suggestion around handling the use-case where there is a change in the format of the reducer? Development is heavy on my project right now and there are occasional changes to reducers. This often causes a conflict when the store is rehydrated using the localStorage state.
Example:
When changing the reducer’s initialState from this:
const initialState = fromJS({
licenses: {
oneLicenseType: {
value: false
},
anotherLicenseType: {
value: false
},
theLastLicenseType: {
value: false
}
}
});
… to this:
const initialState = fromJS({
licenses: {
oneLicenseType: false,
anotherLicenseType: false,
theLastLicenseType: false
}
});
I get the error “Cannot read property 'value' of undefined” when loading the page.
In this particular case where the app reducer format is different from the format in localStorage I would like to overwrite the local version.
Is this possible?
I have same issue.
I solved this issue by using this library.
https://github.com/xiongxiong/redux-persist-version
I found this library too, but that did not fit in my case. redux-persist-migrate seems that does not support immutable.js.
https://github.com/wildlifela/redux-persist-migrate