Rehydration of redux-persist is not working for an unknown reason. Here is my config:
const persistConfig = {
key: 'root',
storage: AsyncStorage,
whitelist: ['user'],
};
export default function configureStore(initialState = {}) {
let reduxSagaMonitorOptions = {};
let composeEnhancers = compose;
if (process.env.NODE_ENV !== 'production' && typeof window === 'object') {
if (window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
trace: true,
});
}
if (window.__SAGA_MONITOR_EXTENSION__) {
reduxSagaMonitorOptions = {
sagaMonitor: window.__SAGA_MONITOR_EXTENSION__,
};
}
}
const sagaMiddleware = createSagaMiddleware(reduxSagaMonitorOptions);
const {run: runSaga} = sagaMiddleware;
const middlewares = [sagaMiddleware, thunkMiddleware];
const enhancers = [
applyMiddleware(...middlewares),
createInjectorsEnhancer({
createReducer,
runSaga,
}),
];
const persistedReducer = persistReducer(persistConfig, createReducer());
const store = createStore(
persistedReducer,
initialState,
composeEnhancers(...enhancers),
);
const persistor = persistStore(store);
return {store, persistor};
}
Heere is the reducer:
export default function createReducer(injectedReducers = {}) {
return combineReducers({
...injectedReducers,
locale: localeReducer,
user: userReducer,
});
}
Here is how the App renderer function:
const initialState = {};
const {store, persistor} = configureStore(initialState);
const renderApp = () => (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<App />
</PersistGate>
</Provider>
);
After user pressed login button:

After app was closed and reopened:

Can anyone help please, what am I doing wrong?
