redux-persist#createMigrate TypeScript Examples

The following examples show how to use redux-persist#createMigrate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: store.ts    From UsTaxes with GNU Affero General Public License v3.0 7 votes vote down vote up
persistedReducer = fsReducer(
  'ustaxes_save.json',
  persistReducer<CombinedState<YearsTaxesState>, Actions>(
    {
      key: 'root',
      // Changing the version here will set the version used
      // in the app. When the data is rehydrated the version
      // number will be compared and all migrations between
      // the persisted version and the version here will be
      // applied in order
      version: 1,
      storage,
      migrate: createMigrate(migrations, { debug: false }),
      transforms: [dateStringTransform]
    },
    rootReducer
  )
)
Example #2
Source File: index.ts    From jellyfin-audio-player with MIT License 6 votes vote down vote up
persistConfig: PersistConfig<Omit<AppState, '_persist'>> = {
    key: 'root',
    storage: AsyncStorage,
    version: 2,
    stateReconciler: autoMergeLevel2,
    migrate: createMigrate({
        // @ts-expect-error migrations are poorly typed
        1: (state: AppState & PersistState) => {
            return {
                ...state,
                settings: state.settings,
                downloads: downloadsInitialState,
                music: musicInitialState
            };
        },
        // @ts-expect-error migrations are poorly typed
        2: (state: AppState) => {
            return {
                ...state,
                downloads: {
                    ...state.downloads,
                    queued: []
                }
            };
        }
    })
}
Example #3
Source File: walletSlice.ts    From celo-web-wallet with MIT License 5 votes vote down vote up
persistConfig = {
  key: 'wallet',
  storage: storage,
  stateReconciler: autoMergeLevel2,
  whitelist: ['address', 'balances', 'type', 'derivationPath', 'secretType', 'account'],
  version: 0, // -1 is default
  migrate: createMigrate(migrations),
}
Example #4
Source File: store.ts    From prompts-ai with MIT License 5 votes vote down vote up
persistConfig = {
    key: 'root',
    version: currentVersion,
    migrate: createMigrate(migrations),
    storage,
}
Example #5
Source File: migrations.ts    From marina with MIT License 5 votes vote down vote up
walletMigrate = createMigrate(walletMigrations as any)