Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redux-persist failed to create sync storage. falling back to noop storage | Next js #1464

Open
shiam-technext opened this issue Jan 27, 2024 · 3 comments

Comments

@shiam-technext
Copy link

I am trying to use redux-persist along with redux-toolkit to store data on local storage on Next Js and TypeScript. But it responded with this error message: "redux-persist failed to create sync storage. falling back to noop storage | Next js"

Here is my store.ts file:

import { configureStore } from '@reduxjs/toolkit';
import { FLUSH, PAUSE, PERSIST, PURGE, REGISTER, REHYDRATE, persistReducer, persistStore } from 'redux-persist';
import languageReducer from './features/language/languageSlice';
import storage from 'redux-persist/lib/storage';

const persistConfig = {
  key: 'mintbookeeping',
  storage: storage,
};

const persistedReducer = persistReducer(persistConfig, languageReducer);

export const makeStore = () => {
  return configureStore({
    reducer: {
      language: persistedReducer
    },
    middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      serializableCheck: {
        ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
      },
    }),
  })
}

export const persistor = persistStore(makeStore());

export type AppStore = ReturnType<typeof makeStore>

export type RootState = ReturnType<AppStore['getState']>
export type AppDispatch = AppStore['dispatch']
@rajneesh069
Copy link

Hey are you getting a white screen for 5 seconds when you use redux-persist and then the content starts loading?

@ciruz
Copy link

ciruz commented Mar 21, 2024

@rajneesh069 I have multiple Next.js projects (v12/v13/v14 w/o app router), some with Redux, some with Zustand, and yes, on one project I get the same error (redux-persist failed to create sync storage. falling back to noop storage.) and a white screen for multiple seconds, when using redux-persist. I assume this must be something project specific or a small mistake I made somewhere, since it's only on this one project.

@rosairekota
Copy link

rosairekota commented Apr 1, 2024

Hey @shiam-technext . I had the same problem. Here is the answer to your concern on this link:
vercel/next.js#15687

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants