Skip to content

Redux-Persist v5 migrate from one storage system to another #806

Open
@alanlanglois

Description

@alanlanglois

I'm working on a project where I need to migrate my data initially stored using AsyncStorage to another one: redux-persist-fs-storage

Based on this issue: #679 I've manage to get the data stored in AsyncStorage this way:

let persistor = persistStore(store, persistConfig, async () => {
  try {
    console.log("GET ASYNC STATE")
    const asyncState = await getStoredState({
      key: 'root',
      storage: AsyncStorage,
     })
     console.log("ASYNC >>>> " + asyncState )
       if (asyncState) {
     }
   } catch (error) {
    console.warn('getStoredState ASYNC error', error)
  }
});

I'm looking a way to inject these data (asyncState) into the new fileSystem store.

In v4 we could achieve that using a rehydrate method on the persistor.

fsPersistor.rehydrate(asyncState, { serial: false })
It's not a migration from v4 to v5, just from a store to another using v5.

Can't find a way to do it in v5. An input on how to do it would be great :)

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions