Blacklist keys
See original GitHub issueHey guys, I was using this great framework to persist my redux state to localStorage and it worked well other than with React-Router-Redux. In my case, my reducers looks like:
const reducer = combineReducers({
...allOtherReducers,
routing: routerReducer
})
Because of autoRehydrate(), whenever I access a route directly by typing http://myappurl/someroute, it will rehydrate my state and redirect back to the original persisted route. Blacklisting seems to be the correct option since the user don’t need to persist their routes.
Following the example, I should do:
persistStore(store, {blacklist: ['routing']})
However, it continued to persist my routes and rehydrate. After some investigation, I realised that the key that should be blacklisted should be reduxPersist:routing because the reduxPersist prepended reduxPersist: at the start of the keys.
Would like to know whether others face this issue and it’ll be great if the getting started guide can reflect this!
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (5 by maintainers)

Top Related StackOverflow Question
On cursory inspection, I suspect what is happening is that you started without the blacklist, state was saved, and then after adding it to the blacklist the old saved value continues to be rehydrated even though no new state is being written over it.
The short fix would be to call
persistor.purgeAll()to clear your state and then it should begin to function as expected.The more sustainable solution is for us to think about having getStoredState respect the whitelist & blacklist. Right now it just restores everything it can find.
don’t remaining token of activation `const clearTokenActivation = createTransform( (inboundState) => { console.log(‘inboundState’, inboundState); return { …inboundState, activatedToken: undefined, }; }, );
persistStore(store, { storage: AsyncStorage, blacklist: [‘auth{activatedToken}’], transforms: [ clearTokenActivation, ], }, () => {`