vitejs / vitejs/vite-plugin-react

Use `renderToPipeableStream` instead of `renderToString` in `ssr-react` playground

Open
#359 2 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending triage plugin: react
Dominant language
TypeScript
Stars
1.2k
Forks
269
Avg merge
1d 3h
Merged PRs (30d)
19

Description

Description

The playground ssr-react uses in the entry-server.jsx the method ReactDOMServer.renderToString which does not support streaming or lazy / suspense components. I'd suggest to replace it with ReactDOMServer.renderToPipeableStream.

Suggested solution

I have made a working example based on the playground (a tiny bit more complex, but in essence the same) here:

https://github.com/technologiestiftung/vite-react-ssg-example/blob/feat/add-streaming-for-suspense/src/entry-server.tsx

If desired, I can make a PR to add these changes. As far as I can tell, nothing else would need to be changed.

Alternative

No response

Additional context

No response

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in playground/ssr-react/entry-server.jsx and inspect how the server-rendered output is produced. Compare it with the linked streaming example, then verify that the playground uses renderToPipeableStream so streaming and lazy or Suspense components are supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
web-dev
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.