cantierecreativo/redux-bees

Server side rendering

Closed this issue · 2 comments

jariz commented

In a server side rendering set up, you'd preferably not render any components until all of them have their data ready.
Has there been put any thought into this yet?
Specifically in combination with the query HOC?

Here's how I think it could look:

The query.js Wrapper class exposes a static function which accepts a redux dispatch function as first argument. It will return a promise that resolves once data is loaded, and dispatches all data to the passed redux function along the way.
The server (with the help of react-router or something similar) then checks which components match the route path and calls all of the static functions if they're available.
Then, if all of these promises have been resolved, the server side can render the components and finish the request.

Just released version 0.1.4 with this feature! https://github.com/cantierecreativo/redux-bees#server-side-data-loading

Feedback is welcome :)

jariz commented

Late reply but thanks dude, this is great!
Will definitely play with this.