How to do HYDRATE correctly?
See original GitHub issueIn 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:
- Created 3 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Your reducers have nothing to do with it. Obviously, your root saga stops before the action to start a new saga comes.
Why was this closed?