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

[Server Side] my first saga fetch is not waited, but all the next ones yes #1989

Closed
tomtom94 opened this issue Dec 2, 2019 · 4 comments
Closed

Comments

@tomtom94
Copy link

tomtom94 commented Dec 2, 2019

I can't make a proper server side.

When I start my server and make a fetch for example http://localhost:3000/last-movie-releases

The first fetch is not waited by toPromise(). But all the other ones I do next are good, server side is then alright.

Just a snippet my code below. I dispatch my redux action in the class constructor. (like everybody does)

  store
    .runSaga(rootSaga)
    .toPromise()
    .then(() => {
      console.log('sagas complete');
      const html = ReactDOMServer.renderToString(jsx);
      const css = sheets.toString();
      res.send(
        renderFullPage(html, css, serialize(store.getState()))
      );
    })
    .catch(e => {
      console.log(e.message);
      res.status(500).send(e.message);
    });

  ReactDOMServer.renderToString(jsx);

  store.close();

Is it a normal behavior ?

PS : My saga making the fetch I am talking about starts with a fork, then a fork again, and a call. Exactly like in the real-word repo

I am wondering if I missed a return somewhere.

@tomtom94
Copy link
Author

tomtom94 commented Dec 3, 2019

I have also opened the exact same issue on stackoverflow

@tomtom94
Copy link
Author

tomtom94 commented Dec 4, 2019

I am reporting a bug issue

Check this https://stackoverflow.com/a/59179039/10294022

@tomtom94 tomtom94 closed this as completed Dec 4, 2019
@tomtom94
Copy link
Author

tomtom94 commented Dec 4, 2019

Issue is now open on loadable-component here

@theKashey
Copy link

Aaaannd it's closed as irrelevant and incorrect.
If you want to fix your case please provide more code, better just all, so it would be more clear what jsx is, and who (where?) triggers the saga.

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