redux-persist
redux-persist copied to clipboard
Redux persist migration empty migrationKeys
"redux-persist": "^6.0.0",
"react": "16.13.1",
"react-native": "0.63.4",
export const migrations = {
0: (state: any) => {
return {
...state,
someObject: { ...state.someObject, someItem: true },
};
},
};
import { configureStore } from '@reduxjs/toolkit';
import AsyncStorage from '@react-native-async-storage/async-storage';
...
const persistConfig = {
key: 'root',
storage: AsyncStorage,
version: 3,
migrate: createMigrate(migrations, { debug: true }),
};
const persistedReducer = persistReducer(persistConfig, rootReducer);
...
migration executes but migrationKeys are empty and nothing migrates.
@arled I couldn't find documentation for it, but the object keys in the first param passed to createMigrate (your migrations const) apparently need to match the target version. Your target version is 3, so it should be 3: (state: any) => { ... } instead of 0