Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions packages/static/src/rsc/entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,12 @@ export async function build() {
let appRscStream: ReadableStream<Uint8Array>;

if (ssrEnabled) {
// SSR on: both streams have full tree
rootRscStream = renderToReadableStream<RscPayload>({
// SSR on: render the full tree once and tee the stream — one branch
// for SSR HTML, one for the app RSC payload. Rendering twice would
// execute every server component (and defer()) twice per entry (#147).
[rootRscStream, appRscStream] = renderToReadableStream<RscPayload>({
root: <Root>{appNode}</Root>,
});
appRscStream = renderToReadableStream<RscPayload>({
root: <Root>{appNode}</Root>,
});
}).tee();
} else {
// SSR off: root stream has shell, app stream has App only
rootRscStream = renderToReadableStream<RscPayload>({
Expand Down