Hello I have a redux store with nested state and multiple reducers such as :
{
user: {
username: “UserOne”
}
content: {
data: “”,
isFetching:true
}
}
I want to ensure that when the user refreshes the app (CTRL + R) , all state is persisted except isFetching which should reset to false.
I have set up my redux store with a persistor as follows to try to achieve this:
const persistingReducer = createBlacklistFilter('content', ['content.isFetching']);
const persistConfig = {
key: 'root',
transforms: [persistingReducer],
// Refer to migrations file for versions
version: 20210426,
storage,
stateReconciler: autoMergeLevel2,
migrate: createMigrate(migrations, { debug: true })
};
const reducers = combineReducers({
content,
user
});
const rootReducer = (state: Store | undefined, action: Action) => {
if (action.type === USER_LOGOUT) {
state = undefined;
console.log('Logged out. Store reset.');
}
return reducers(state, action);
};
export default persistReducer(persistConfig, rootReducer);
However, the isFetching property still remains true after refresh. Anyone have any idea why.