-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
feat: streaming rendering with Suspense boundaries as flush trigger #296
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 <[email protected]>
🦋 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 |
8c01d08
to
e006bb7
Compare
9af40f9
to
1579648
Compare
2bb7ca2
to
cbabc9e
Compare
10f293e
to
1f06bbf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Left some minor comments, but I'm good with landing this as early as possible and iterating on it in main
👍
Promise.resolve().then(() => { | ||
options.onShellReady && options.onShellReady(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The render runs synchronously, so after a micro-tick this just tells us that the synchronous shell render is done
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
_parent
while streaming this would need to happen after everything 😩Solved it by using
_vnodeId
to have consistent ids for Suspense boundaries, keep checking for additions to the boundaries withforkSuspended
and more fixes.Demo
The demo basically forces a less than ideal scenario:
useQuery
which 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.