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

Asynchronous render replaced with synchronous renderToString #226

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

szymonkorytnicki
Copy link

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
Copy link
Owner

arendjr commented Mar 9, 2018

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.

3 participants