question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recursive call HYDRATE, can anyone help?

See original GitHub issue
image

`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:closed
  • Created a year ago
  • Reactions:9
  • Comments:7

github_iconTop GitHub Comments

3reactions
DimkaSklyarcommented, Jul 28, 2022

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 ^__^~

2reactions
DiegoMcDipstercommented, Jul 29, 2022

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Recursive function in doctrine - Stack Overflow
If I query person entity in a recursive funcion it only returns me the first three levels. Do you know how to tell...
Read more >
Recursive Calls - IBM
Each recursive call causes a new invocation of the procedure to be placed on the call stack. The new invocation has new storage...
Read more >
Recursion is not hard: a step-by-step walkthrough of this ...
A recursive function is a function that calls itself until a “base condition” is true, and execution stops. While false, we will keep...
Read more >
IC210: Functions V - Recursion
This function has an infinite recursion, meaning that recursive calls are made over and over again, without any mechanism to stop the process....
Read more >
Improving efficiency of recursive functions - Khan Academy
Recursion can be an elegant way to solve a problem, and many algorithms lend ... to recursively compute the factorial of a number,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found