Open
Description
Here I am trying to persist PatientsReducer as well as AuthReducer.
When doing just for AuthReducer it is working as expected. But when including PatientsReducer in the whitelist array the whole redux store is getting cleared.
Here's my Store.ts
import AsyncStorage from '@react-native-async-storage/async-storage';
import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit';
import { persistReducer, persistStore } from 'redux-persist';
import rootReducer from './store-config/StoreConfig';
const persistConfig = {
key: 'root',
storage: AsyncStorage,
whitelist: ['auth', 'patients'],
};
const persistedReducer = persistReducer(persistConfig, rootReducer);
const store = configureStore({
middleware: getDefaultMiddleware({
serializableCheck: false,
}),
reducer: persistedReducer,
});
const persistor = persistStore(store);
export { store, persistor };
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
Any help is highly appreciated.
Metadata
Metadata
Assignees
Labels
No labels