Wait for redux action / promise before render
See original GitHub issueWe’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?
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (9 by maintainers)
Top 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 >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
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?
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.