Closed jachenry closed 9 years ago
That's correct.
Because React doesn't support async rendering, we have to make multiple passes through the component tree until all promises have resolved on the server.
There are a couple ways to try & solve this (#57 for example), but they're all pretty complex and will be resolved at a later date.
@bbnnt Mentioned this issue from #77. Is this actually a problem? React is meant to re-render multiple times by design, and this is leveraged to generate a working server-side view.
If it's not, I'd rather close this in favor of #57.
I might lack of a more advanced understanding of react itself right here; I just liked the fact that for the first page load and when routing, the rendering was occurring after the data fetch. Now the page's empty for a very short amount of time — well, depending on the duration of the fetch but it still works server side as expected
I think @jachenry's question was why rendering happened twice (it can actually happen many more times, depending on the depth of the tree) on the server.
As for the client, by itself, Resolver will render on the client progressively the same way a normal SPA would. There just happens to be a couple ways to:
Either way, until #57 happens and server-side rendering can pick up mid-tree, the multi-pass approach is the cleanest way of accomplishing this.
Again, it should not be a problem for the application as React intends for the whole tree to be re-renderable at any point in time.
My bad I'm sorry; I should not have pointed this one out on the other post. I was concerned about #75 (links breaks, the solution provided is what I just described right here)
I've been noticing an issue where the componentWillMount/render methods inside my root component get called twice when rendering on the server. Attached below are some code snippets from the important parts.
Routes.js
server.js
Main.js
logs
Is anyone else seeing this issue? The issue goes away when I remove the react-resolver from the equation.