Skip to content

Conversation

@gnoff
Copy link
Owner

@gnoff gnoff commented Jan 16, 2023

Summary

How did you test this change?

gnoff added 7 commits January 16, 2023 09:39
This commit adds the function renderIntoDocument in react-dom/server and adds the ability to embed the rendered children in the necessary html tags to repereset a full document. this means you can render "<html>...</html>" or "<div>...</div>" and either way the render will emit html, head, and body tags as necessary to describe a valid and complete HTML page.

Like renderIntoContainer, renderIntoDocument provides a stream immediately. While there is a shell of sorts this fucntion will start writing content from the preamble (html and head tags, plus resources that flush in the head) before finishing the shell.

Additionally renderIntoContainer accepts fallback children and fallback bootstrap script options. If the Shell errors the  fallback children will render instead of children. The expectation is that the client will attempt to render fresh on the client.
When you pass a fallback to renderIntoDocument it will emit the fallback if the shell of the primary children errors. It is possible for the fallback to also error in the shell in which case the result is a fatalError as if you did not provide a fallback.

Included in this change is a refactoring of how preamble and postamble work. They are now interned within the resposneState where we can have more careful control over what is flushed and when.

There is also a new concept of an early preamble. the early preamble is the html and head tags plus any resources that can flush (most things plus stylesheets up to the first precedence)
@gnoff gnoff force-pushed the fizz-into-document branch from 45a1577 to 3ec1561 Compare January 18, 2023 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants