Skip to content

test: add ssr-react-streaming #471

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hi-ogawa
Copy link
Collaborator

@hi-ogawa hi-ogawa commented Apr 29, 2025

Description

I was revising React streaming and also the discussion of whether we should add async: true to preamble script #352.

My conclusion is that it's fine to always add async: true since otherwise inline module script <script type="module">console.log("foo")</script> is always blocked until full html load and React preamble script doesn't need to wait. (For this one, I'll raise a separate PR.)

However, regardless of having async or not, relying on transformIndexHtml for ssr streaming is likely not a good idea because in order to fully utilize streaming feature, bootstrapModules of streaming API is recommended, but then, to avoid race condition of execution order between react hmr injectIntoGlobalHook and bootstrapModules, it's required to have an additional logic around it. In this PR, I added playground test as a demo to show one way to achieve this (which is using virtual client entry as wrapper). It's rather verbose, so maybe not necessary to have it here (and it's more of SSR framework territory), but I can show it as a reference to close the issue at least 🙂

@hi-ogawa hi-ogawa marked this pull request as ready for review April 30, 2025 02:34
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.

Use renderToPipeableStream instead of renderToString in ssr-react playground
1 participant