rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.91k stars 862 forks source link

Blank White Screen After Adding Persist - Used with Redux Toolkit Query (React Native) #1406

Open sokoya opened 1 year ago

sokoya commented 1 year ago

Hello Devs.

I tried adding redux persist to my application, followed all the guidelines, however, it shows blank white screen, Please I am lost of idea, solution...

My Stack is "expo": "^45.0.5", "react-redux": "^8.0.2", "redux": "^4.2.0", "redux-persist": "^6.0.0",

Below is my store.js

const preloadedState = { auth: { user: false, showWallet: false, accessToken: null } }

const persistConfig = { key: 'root', storage: AsyncStorage, version: 1, whitelist: ['auth'], blacklist: [apiSlice.reducerPath], stateReconciler: autoMergeLevel2, }

`const reducers = {

[authSlice.name]: authReducer,

}`

const combinedReducer = combineReducers(reducers);

export const rootReducer = ( state, action ) => { if( action.type === RESET_STATE_ACTION_TYPE ) { state = {} } return combinedReducer(state, action) }

const persistedReducer = persistReducer(persistConfig, combinedReducer)

const store = configureStore({ reducer: persistedReducer, middleware: (getDefaultMiddleware) => getDefaultMiddleware({ serializableCheck: { ignoredActions: [FLUSH, REHYDRATE,PAUSE, PERSIST, PURGE, REGISTER] } }).concat([ unauthenticateMiddleware, apiSlice.middleware, ]), preloadedState: preloadedState })

export default store;

And on my App.js

`

  </Provider>`

If I removed the <PersistGate .../> my app will be fine Please is there anything I am missing here.

PS: No error message.

linonetwo commented 1 year ago

what an ugly issue format

Dacker15 commented 1 year ago

I had the same problem. This was due to the fact that I didn't configure any persist actions