-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
Description
@edy thanks for this repo!
It seems the rehydration is not properly dealing with defaults when using transforms.
Here my default state:
const defaultState = {
computing: [],
notification: null,
token: null,
data: {},
};
Here the persist transforms applied (I want only main.token to be persisted):
import { createFilter, createWhitelistFilter, createBlacklistFilter } from 'redux-persist-transform-filter';
const loadFilter = createWhitelistFilter('main', ['token']);
const persistConfig = {
key: 'user',
keyPrefix: 'user/',
transforms: [loadFilter]
};
What happens after rehydrate dispatch is the following:
{
main: {
token: 'blabla'
},
_persist: {
version: -1,
rehydrated: true
}
}
Since data:{} default is not applied but totally removed because ignored in the transform I get errors.
How can I deal with this situation? Persist just wanted keys and apply defaults to the others?
Would it be possible to always rehydrate to the default and then apply the rehydration of wanted subkeys?
Reactions are currently unavailable