Skip to content

Commit 83f7abd

Browse files
authored
chore(rsc): remove use(payload) workaround (#966)
1 parent 51160f3 commit 83f7abd

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

packages/plugin-rsc/examples/basic/src/framework/entry.ssr.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ export async function renderHTML(
2424
// deserialization needs to be kicked off inside ReactDOMServer context
2525
// for ReactDomServer preinit/preloading to work
2626
payload ??= createFromReadableStream<RscPayload>(rscStream1)
27-
return <FixSsrThenable>{React.use(payload).root}</FixSsrThenable>
28-
}
29-
30-
function FixSsrThenable(props: React.PropsWithChildren) {
31-
return props.children
27+
return React.use(payload).root
3228
}
3329

3430
// render html (traditional SSR)

packages/plugin-rsc/examples/starter/src/framework/entry.ssr.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,7 @@ export async function renderHTML(
2424
// deserialization needs to be kicked off inside ReactDOMServer context
2525
// for ReactDomServer preinit/preloading to work
2626
payload ??= createFromReadableStream<RscPayload>(rscStream1)
27-
return <FixSsrThenable>{React.use(payload).root}</FixSsrThenable>
28-
}
29-
30-
// Add an empty component in between `SsrRoot` and user `root` to avoid React SSR bugs.
31-
// SsrRoot (use)
32-
// => FixSsrThenable
33-
// => root (which potentially has `lazy` + `use`)
34-
// https://github.com/facebook/react/issues/33937#issuecomment-3091349011
35-
function FixSsrThenable(props: React.PropsWithChildren) {
36-
return props.children
27+
return React.use(payload).root
3728
}
3829

3930
// render html (traditional SSR)

0 commit comments

Comments
 (0)