-
Notifications
You must be signed in to change notification settings - Fork 866
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
Safe migration from AsyncStorage
to redux-persist-filesystem-storage
#679
Comments
another version with promises (1st message updated) const fsPersistor = persistStore(
this.store,
{ storage: FilesystemStorage },
async (fsError, fsResult) => {
if (_.isEmpty(fsResult)) {
try {
const asyncState = await getStoredState({
storage: AsyncStorage,
})
if (!_.isEmpty(asyncState)) {
fsPersistor.rehydrate(asyncState, {
serial: false,
})
}
} catch (getStateError) {
console.warn('getStoredState error', getStateError)
}
}
},
) |
Original issues: rt2zz/redux-persist#199 rt2zz/redux-persist#284 Converastions related to provided snippet: rt2zz/redux-persist#679 robwalkerco#7
Original issues: rt2zz/redux-persist#199 rt2zz/redux-persist#284 Converastions related to provided snippet: rt2zz/redux-persist#679 robwalkerco#7
Provide sample snippet which lets app migrate data previously stored in `AsyncStorage` to `redux-persist-filesystem-storage` Original issues: rt2zz/redux-persist#199 rt2zz/redux-persist#284 Converastions related to provided snippet: rt2zz/redux-persist#679 robwalkerco#7
Provide sample snippet which lets app migrate data previously stored in `AsyncStorage` to `redux-persist-filesystem-storage` Original issues: rt2zz/redux-persist#199 rt2zz/redux-persist#284 Converastions related to provided snippet: rt2zz/redux-persist#679 robwalkerco#7
this looks great / correct! Unfortunately this approach only works for v4, but very similar code can be adapted for a v4 -> v5 upgrade. Basically in v5 the approach is to have a custom Open to suggestion on how to make these types of migrations more painless. I am contemplating something like |
that is true, I updated 1st post |
I'm a little confuse, any place where I can find an example of AsyncStorage to redux-persist-filesystem-storage migration using V5? |
Working on it
but I can't really see how rehydrate the file storage store with these data, as fsPersistor.rehydrate doesn't exists anymore in v5. Should I use Transform? or is there a method replacing .rehydrate in v5? |
See #806 (comment) |
Hello,
update I'm on redux-persist v4
update 2 works for redux-persist v4 ONLY
I am writing custom migration routine that will take data that was saved with one storage and save it under another one. More specifically I want to migrate from
AsyncStorage
to https://github.com/robwalkerco/redux-persist-filesystem-storage to prevent issues related to sqlite size/cursor memory limits on android. Please find snippet below, do you think it is the best way to do such thing? Is there any better way to tell if store was previously saved than checking_.isEmpty(state)
?update added try-catch
update 2 with promises
Thanks.
The text was updated successfully, but these errors were encountered: