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

A new Univeral app utility for Redux #539

Closed
ForbesLindesay opened this issue Aug 16, 2015 · 5 comments
Closed

A new Univeral app utility for Redux #539

ForbesLindesay opened this issue Aug 16, 2015 · 5 comments

Comments

@ForbesLindesay
Copy link
Contributor

I've built a small utility called redux-wait for helping to write universal redux apps. It relies on asynchronous middleware returning a promise for when the action has been handled, but if that's the case, it's pretty much a seamless transition from client side to universal.

I wrote up the steps I went through to convert the real-world example into a universal application in https://github.com/ForbesLindesay/redux-wait/tree/master/example It's also worth mentioning that step 1 can be removed if #537 is merged.

Would it be possible to add this to the "ecosystem" part of the docs?

@phated
Copy link

phated commented Aug 16, 2015

How is this different than redux-promise?

@johanneslumpe
Copy link
Contributor

@phated The idea here is that you can dispatch as any actions as you want - as long as they return a promise your application will not be rendered until all of them have been resolved. redux-promise on the other hand translates a returned promise into an action. So they can be use in conjunction.

@johanneslumpe
Copy link
Contributor

@ForbesLindesay I'm curious though what the performance is for cascading actions, when you have to call React.renderToString multiple times on the server.

@ForbesLindesay
Copy link
Contributor Author

I'm not sure, that's definitely a good question. One thing I'd like to try is some sort of "render to undefined" that would do the render but ignore the results, then do one final render at the end.

If we did that we might also be able to fix the multiple calls to componentWillMount, which would allow the real-world example to work pretty much out of the box.

@gaearon
Copy link
Contributor

gaearon commented Sep 4, 2015

My feedback: it's better not to provide your own applyMiddleware. It's exactly the situation we had in #678 (comment): each helper wanting to “own” applyMiddleware isn't the right way.

For now, there is nothing actionable for Redux team here, the issue has been inactive for a while, so I'm closing. Thanks for sharing!

@gaearon gaearon closed this as completed Sep 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants