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.

How to do HYDRATE correctly?

See original GitHub issue

In my application(next.js + redux-saga) I make an ssr request to get user data. I get the data and save it to storage, and then in saga I want to run another saga on a successful action from the first saga.

The first request works, I get the data from the server and save them to the store, then I start the second saga, and it works too and there is data, but there is no data in the store on the client

I call the first saga in _app.js Inside this saga, if we have a successful response, I run an action which saves the data to the store. Also, I subscribe to this successful action and when this event is triggered, I run another saga. And the data from the other saga is not in the store on the client

The current code with HYDRATE is

const reducers = (state, action) => {
  if (action?.type === HYDRATE) {
    const nextState = {
      ...state,
      ...action.payload,
    };

    return nextState;
  }

  return combinedReducer(state, action);
};

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
fostyfostcommented, Mar 23, 2021

Your reducers have nothing to do with it. Obviously, your root saga stops before the action to start a new saga comes.

0reactions
wescopelandcommented, Apr 23, 2021

Why was this closed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

6 Simple Ways to Stay Hydrated - Scripps Health
Don't wait till you're thirsty to drink. By the time you feel thirsty, you're already slightly dehydrated. · Flavor your water. · Eat...
Read more >
How to Properly Hydrate - The Whole U
The American College of Sports Medicine recommends drinking at least 2-2 ½ cups (16-20 ounces) of fluid one to two hours before an...
Read more >
How To Hydrate Effectively: What Should You Drink, How ...
The best strategy is to be proactive with your hydration. This means you should begin hydrating upon waking up. Aim to consume about...
Read more >
How to Hydrate: Drinking Water, Soup, Electrolytes, and More
The best way to hydrate is to drink water. This is far from the only way, and there are tastier alternatives (and some...
Read more >
How to Rehydrate: 5 Helpful Tips - Healthline
The 5 Best Ways to Rehydrate Quickly · 1. Water · 2. Coffee and tea · 3. Skim and low fat milk ·...
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