Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Asynchronous render replaced with synchronous renderToString#226

Open
szymonkorytnicki wants to merge 1 commit into
arendjr:masterfrom
szymonkorytnicki:synchronous-render-to-string
Open

Asynchronous render replaced with synchronous renderToString#226
szymonkorytnicki wants to merge 1 commit into
arendjr:masterfrom
szymonkorytnicki:synchronous-render-to-string

Conversation

@szymonkorytnicki

Copy link
Copy Markdown

Hey,

Thank you for awesome library :) I use selectivity a lot.
I found an error when migrating from React 15 to React 16.

ReactDOM.render is extremely fast, but asynchronous. Some elements may not be rendered on time in current React plugin implementation.

We need synchronous way to render components. This PR is just one way to do it, but I think it's nice and tidy.

@arendjr

arendjr commented Mar 9, 2018

Copy link
Copy Markdown
Owner

Thanks for the PR!

At first sight it looks good, but doesn't the renderToString() from react-dom/server use an entirely separate reconciler from the regular react-dom? I migrated away from the using the server renderer in Selectivity 3.0.1 because that turned out to be a bad idea when React 15.4 was released. I have a note about it in my release notes, but it doesn't explain the full rationale :) IIRC, the React team doesn't consider shipping the server renderer to clients a valid use case, and I'm concerned this change would leave people with a dependency of including the server renderer which inflates package sizes quite considerably.

I'll admit I moved away from using React templates with Selectivity for my own project (I just use ES6 template strings now), but I'm open to suggestions how this can be properly resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants