Problem
In build() (packages/static/src/rsc/entry.tsx), when ssr is enabled, the identical element is rendered through two separate renderToReadableStream calls:
rootRscStream = renderToReadableStream<RscPayload>({ root: <Root>{appNode}</Root> });
appRscStream = renderToReadableStream<RscPayload>({ root: <Root>{appNode}</Root> });
Consequences:
- every server component executes twice per entry (double data fetching / build work);
- every
defer() call runs twice, registering two registry entries whose payloads are both fully rendered; content-hashing later collapses the duplicates to the same output file, which hides the wasted work but doesn't avoid it.
Suggested fix
Render once and tee() the stream — one branch for renderHTML (SSR), one written as the app RSC payload. This halves build-time rendering and guarantees the two consumers see byte-identical streams.
Found during a framework audit.
Problem
In
build()(packages/static/src/rsc/entry.tsx), whenssris enabled, the identical element is rendered through two separaterenderToReadableStreamcalls:Consequences:
defer()call runs twice, registering two registry entries whose payloads are both fully rendered; content-hashing later collapses the duplicates to the same output file, which hides the wasted work but doesn't avoid it.Suggested fix
Render once and
tee()the stream — one branch forrenderHTML(SSR), one written as the app RSC payload. This halves build-time rendering and guarantees the two consumers see byte-identical streams.Found during a framework audit.