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

[SSR/redux-saga] first request http get doesn't trigger actions, but all the next ones yes #473

Closed
tomtom94 opened this issue Dec 4, 2019 · 1 comment

Comments

@tomtom94
Copy link

tomtom94 commented Dec 4, 2019

I am encountering an issue.

When I just start my environment development or production server after an upgrade.

I realized my redux actions are not triggered the first time I make a request http get to get the DOM. But triggered all the time afterwards.

I know this is due to the split code loadable-component. But is there a way to catch the redux trigger action all the time (especially the first time when the server just started)

Many thanks.

@theKashey
Copy link
Collaborator

Redux saga, as well as data-fetching during SSR is something loadable component should not carry about. And could not carry about.

SSR is a single pass process, and you have to have all the data (and await for it) before rendering application. Sometimes to make it work you have to "render" you application a few times, untill it would not emit any new side effects on the next render - for example this is how graphql apollo works.

What shall you do - think how to "ask" for the data outside of React, and especially outside of React Component constructor.
Just throw react-router to the bin, and use react-navi or react-first-router.

Fix the root cause.

@tomtom94 tomtom94 changed the title [SSR/redux-saga] first F5 fetch not waited, but all the next F5 ones yes [SSR/redux-saga] first request http get doesn't trigger actions, but all the next ones yes Dec 19, 2020
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

2 participants