feat: streaming rendering with Suspense boundaries as flush trigger#296
Merged
JoviDeCroock merged 38 commits intomainfrom May 6, 2024
Merged
feat: streaming rendering with Suspense boundaries as flush trigger#296JoviDeCroock merged 38 commits intomainfrom
JoviDeCroock merged 38 commits intomainfrom
Conversation
feat: use custom element for hydration feat: add onError to renderToChunks feat: add renderToPipeableStream
This reduces code and *should* also be more performant than recursive JS iteration. See: https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator
feat: use comments instead of element as marker
… on #241 (#267) * use index.module.js when benchmarking, since its the output of `npm run transpile` * fix bench:v8 output path * update microbundle and turn off function inlining * fix JSX entrypoint and tests * fix type defintion to reflect removed exports and options * fix root copy of jsx types * optimize renderToString performance using switch and short-circuiting * Create bright-ligers-jam.md * Update bright-ligers-jam.md * Update bright-ligers-jam.md * Backport changes from #237 (child/parent properties, simplified Fragment handling) * ci: update github actions (#266) * ci: update actions/checkout to v3 * ci: update actions/cache to v3 * merge master * lockfile version * update benchmarking reference implmementation to 5.2.6 (6a0bec2) * fix tests * fix before diff hook being called on invalid vnodes * move non-exported files into a lib directory * update pretty implementation and move typedefs into a d.ts * Move chunked implementation out of the default entrypoint * update tests to reflect chunking being moved out of default entrypoint * fix d8 bench script --------- Co-authored-by: Abdul Rauf <abdulraufmujahid@gmail.com>
🦋 Changeset detectedLatest commit: cb505ac The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
JoviDeCroock
commented
Mar 30, 2023
8c01d08 to
e006bb7
Compare
9af40f9 to
1579648
Compare
2bb7ca2 to
cbabc9e
Compare
10f293e to
1f06bbf
Compare
Closed
marvinhagemeister
approved these changes
May 6, 2024
Member
marvinhagemeister
left a comment
There was a problem hiding this comment.
This is great! Left some minor comments, but I'm good with landing this as early as possible and iterating on it in main 👍
Comment on lines
+44
to
+46
| Promise.resolve().then(() => { | ||
| options.onShellReady && options.onShellReady(); | ||
| }); |
Member
There was a problem hiding this comment.
Would this fire when the rendering of the shell already errors? Not sure if the expected behavior is to call onShellReady regardless or only in the error case.
Member
Author
There was a problem hiding this comment.
The render runs synchronously, so after a micro-tick this just tells us that the synchronous shell render is done
marvinhagemeister
approved these changes
May 6, 2024
Merged
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Preact
I use a build of Preact with comments enabled for the demo preactjs/preact#4128
Notes
While creating this demo I noticed a bug where when we suspend twice from a streaming boundary we end up in an infinite loop, also we can't unset
_parentwhile streaming this would need to happen after everything 😩Solved it by using
_vnodeIdto have consistent ids for Suspense boundaries, keep checking for additions to the boundaries withforkSuspendedand more fixes.Demo
The demo basically forces a less than ideal scenario:
useQuerywhich is suspense enabled and throws as it doesn't have the pokemons - hydration pausesNormally front-end data-fetching libraries will include the data in a
<script>tag that gets flushed to the client so the data-restoration is synchronous. This demo however is meant to show off the resumed hydration.