Closed zilahir closed 3 years ago
hey,
i am running into a problem where a piece of a state disappears during rehydrate.
I have increased the version number, and created a migration:
export const migrateStore = { 4: state => ({ ...state, layout: { ...state.layout, misc: { ...state.layout.misc, rootLevelGalleryOptions: { // THIS IS NEW ...rootLevelGalleryOptions, }, }, }, }), }
and then:
const persistConfig = { key: 'root', storage, version: 4, blacklist: ['temp'], migrate: createMigrate(migrateStore, { debug: true }), }
the debug notifies me, that the migration has run. Then using redux-logger to observe the changes during the dispatched actoins.
redux-logger
action persist/REHYDRATE
in the prevState i have the object in question: state.layout.misc.rootLevelGalleryOptions.
prevState
state.layout.misc.rootLevelGalleryOptions
Then when the REHYDRATE action is being callled, the key rootLevelGalleryOptions is misising from the payload, therefore it gets rehydrated this way.
REHYDRATE
rootLevelGalleryOptions
payload
Which will result with the migration not working, as I am still missing that new key from the store.
Is this a bug, or am I missing to understand something?
hey,
i am running into a problem where a piece of a state disappears during rehydrate.
I have increased the version number, and created a migration:
and then:
the debug notifies me, that the migration has run. Then using
redux-logger
to observe the changes during the dispatched actoins.in the
prevState
i have the object in question:state.layout.misc.rootLevelGalleryOptions
.Then when the
REHYDRATE
action is being callled, the keyrootLevelGalleryOptions
is misising from thepayload
, therefore it gets rehydrated this way.Which will result with the migration not working, as I am still missing that new key from the store.
Is this a bug, or am I missing to understand something?