Recursive call HYDRATE, can anyone help?
See original GitHub issue`import { createWrapper, HYDRATE } from “next-redux-wrapper”; import { configureStore, applyMiddleware, Store } from “@reduxjs/toolkit”; import createSagaMiddleware, { Task } from “redux-saga”; import Immutable from “seamless-immutable”;
import { loggerNext } from “…/middlewares/loggerReduxSagaNext”; import rootReducer from “./root-redux”; import rootSaga from “./root-saga”;
export interface SagaStore extends Store { sagaTask?: Task; }
const hydrate = (state, action) => { if (action.type === HYDRATE) { return Immutable({ …state, …action.payload }); }
return rootReducer(state, action); };
const makeStore = () => { const sagaMiddleware = createSagaMiddleware();
const store = configureStore({ reducer: hydrate, enhancers: [applyMiddleware(sagaMiddleware, loggerNext)], devTools: process.env.NODE_ENV === “development”, });
(store as SagaStore).sagaTask = sagaMiddleware.run(rootSaga);
return store; };
export const storeWrapper = createWrapper(makeStore, { debug: false, }); `
Issue Analytics
- State:
- Created a year ago
- Reactions:9
- Comments:7
Top GitHub Comments
I have this problem after updating dependencies. I found the problem using the exclusion method.
The problem to
react-redux v. 8.0.2
for some reason happens as described above - a “Recursive call HYDRATE”.There is no such problem with
react-redux v. 7.2.8
.Also, the problem disappear with
next-redux-wrapper v. 8.0.0-rc.1
+react-redux v. 8.0.2
.Hope this helps you ^__^
I apologize for my English ^__^~
@DimkaSklyar thanks! I installed react-redux v 7.2.8 and the problem does indeed disappear.
I also had to switch reactStrictMode: false in my next.config.js to prevent it running twice.
Now it’s behaving as it should.