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.

Wait for redux action / promise before render

See original GitHub issue

We’re trying to render a page that displays a shareable video file loaded from a third party server, and make it so that social media parsers (like Facebook) would pick up meta tags we put in Helmet for that video.

The problem is that right now there seems to be no way to make the server wait for an action to finish before rendering, so the Helmet update takes a second or so - which means the Facebook parser treats it as if there were no metatags on it.

Is there any way to make este wait for a promise before rendering the server-side part?

If not, would something like this work with este? https://github.com/makeomatic/redux-connect

What would be a good place in the general structure to implement something like this?

@tarkanlar

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
israelidannycommented, Sep 8, 2016

Yeah, I saw este implementation and how you dispatch. But if I’m not mistaken, the example above will immediately return _START and then loadOnServer() won’t wait for either _ERROR or _SUCCESS. At least that’s what I’m experiencing.

redux doesn’t tolerate promises, and each action should be a plain object, correct? So the moment I call the request, - as far as loadOnServer() is concerned, I’m done.

Am I wrong?

0reactions
rkobergcommented, Sep 8, 2016

I showed how I dispatch an action above. Este does not use redux-thunk, rather its own implementation which is basically the same (uses _START, _ERROR, _SUCCESS). I think you need to spend some time going through the source and working it out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wait for react-promise to resolve before render - Stack Overflow
So I am wondering how I can wait for the promise to resolve the data completely before calling my renderMarkers function? class Map...
Read more >
Redux Fundamentals, Part 6: Async Logic and Data Fetching
Just like with a normal action, we first need to handle a user event in the application, such as a click on a...
Read more >
Redux-thunk dispatch an action and wait for re-render-Reactjs
I think that you can have confidence that the updated Redux state data is there before you perform your focus() call, because of...
Read more >
redux-wait-for-action - npm
Redux middleware to make store.dispatch() return a promise which will be fulfilled when another specified action is dispatched, which is useful ...
Read more >
Suspense for Data Fetching (Experimental) - React
Suspense lets your components “wait” for something before they can render. ... Kick off fetching as early as possibleconst promise = fetchProfileData(); ...
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