-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Streaming renderer #259
Streaming renderer #259
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
src/index.js
Outdated
if (renderer !== undefined && error.then) { | ||
/** @type {import('./internal').Component} */ | ||
let component; | ||
let susVNode = vnode; |
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.
Much sus, very amogus 😂
Any updates on this? It's a blocker for using Preact with Nextjs. |
Also a blocker for Remix, too. |
👋 This is also a blocker for |
… 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>
Any updates here? As stated above this is a big issue for users trying to upgrade to Gatsby v5. |
Landing this PR doesn't make Preact support React's streaming renderer API, that would need to be plumbed through to preact/compat/server. The reason we have not yet merged this PR is that it may require changes in Preact to handle client-side hydration for subtrees that are streamed out-of-order. Currently, it's likely that there is a race condition in if any suspense boundaries encountered during hydration manage to resolve and resume hydration prior to their corresponding out-of-order subtrees having been moved into place. This would cause tearing or duplicated DOM. In order to move forward, we need an end-to-end demo that recreates this scenario so that we can find the best mechanism for deferring hydration that does not rely on streaming knowledge in Preact core. |
Hi, thank you so much for this fantastic project! Do you guys have any update about what @developit explained? |
This comment was marked as off-topic.
This comment was marked as off-topic.
1 similar comment
This comment was marked as off-topic.
This comment was marked as off-topic.
Almost end of 2023 and there is no updates on this? Latest NextJS and Gatsby apps really depend on this to be able to use Preact instead of React |
@AnderUstarroz you could help us test it #296 is the updated Pr and there's a linked Preact PR |
No problem @JoviDeCroock , just tell me which versions of
|
As Jovi mentioned, there's two open PRs. You'd have to build preact & rts from source. |
Any updates? It is still a problem for Gatsby 5+ users |
Bummer that this isn't generally available yet. Looking forward |
Superseded by #296 and released in 6.5.0 |
This PR that adds a streaming renderer. Main difference to
preact-ssr-prepass
is that it only awaits suspense boundaries and keeps everything else synchronous. This avoids a flooding the event loop with microtasks.Tried a custom element approach to attach lazy hydrated subtrees, but the more I think about it the more I'm leaning towards using comments as folks sent me more and more use cases where introducing an arbitrary element breaks CSS styling (even with
display: contents
) or where the semantic HTML structure falls apart (ul > li
).Marking as draft until it's ready and we might need to make modifications to core too.