Skip to content
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

Handling updates to the format of the reducer that conflicts with local version #28

Open
brandondurham opened this issue May 10, 2017 · 2 comments

Comments

@brandondurham
Copy link

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?

@aglio
Copy link

aglio commented Jul 10, 2017

I have same issue.

@aglio
Copy link

aglio commented Jul 10, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants