-
Notifications
You must be signed in to change notification settings - Fork 47k
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
ReactDOMServer.renderToStaticMarkup gets stuck while trying to render Portals #11692
Comments
Want to dig into why this happens? I'd expect an error there. |
It seems to enter this while loop Is it not possible for it return the markup? What kind of error would you expect? |
It looks like it's because |
I think we want to throw when |
Oh. We used to fail in |
So is the expected behavior that we throw an error when trying to render a Portal using |
Yes. You can't render them anyway because they throw on a missing DOM node. And you can't have a DOM node on the server. So you're supposed to skip them in the server code. |
I have a fix in #11709. |
Okay. We'll include the fix for the hanging loop in the next release (which might take a couple of weeks). It's not common anyway since to reproduce it you'd need to server render on the client. But still, this use case is currently unsupported, and you'd need to pass data down your components to not render the portal in this case. I would also say it's not super great to use SSR renderer on the client because it brings extra bytes. You might as well |
Thanks! |
Oh I see. Thanks for explaining the context. |
Calling
ReactDOMServer.renderToStaticMarkup(elementWithPortal);
gets stuck in a loop while trying to do a static render.Current behavior:
The behavior can be seen here: https://codepen.io/anon/pen/BmqWOM by un-commenting line 58 (warning: this will make your tab freeze)
Expected behavior:
It should return with results or throw some kind of error if the input is not valid
The text was updated successfully, but these errors were encountered: