Skip to content
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

Float hoistables #13

Open
wants to merge 7 commits into
base: fizz-into-document
Choose a base branch
from
Open

Float hoistables #13

wants to merge 7 commits into from

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.

1 participant