Skip to content

Commit 89a1aea

Browse files
committed
chore: tweak
1 parent afec24c commit 89a1aea

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,21 @@ export async function renderHTML(
1919
const [rscStream1, rscStream2] = rscStream.tee()
2020

2121
// deserialize RSC stream back to React VDOM
22-
let payload: Promise<RscPayload>
22+
let payload: Promise<RscPayload> | undefined
2323
function SsrRoot() {
2424
// deserialization needs to be kicked off inside ReactDOMServer context
2525
// for ReactDomServer preinit/preloading to work
2626
payload ??= ReactClient.createFromReadableStream<RscPayload>(rscStream1)
2727
const root = React.use(payload).root
28-
return <SsrUseWorkaround>{root}</SsrUseWorkaround>
28+
return <FixSsrThenable>{root}</FixSsrThenable>
2929
}
3030

31-
// Add an empty component in between SsrRoot and user's root to avoid React SSR bugs.
32-
// > SsrRoot (use) -> SsrUseWorkaround -> root (which potentially has `lazy` + `use`)
31+
// Add an empty component in between `SsrRoot` and user `root` to avoid React SSR bugs.
32+
// SsrRoot (use)
33+
// => FixSsrThenable
34+
// => root (which potentially has `lazy` + `use`)
3335
// https://github.com/facebook/react/issues/33937#issuecomment-3091349011
34-
function SsrUseWorkaround(props: React.PropsWithChildren) {
36+
function FixSsrThenable(props: React.PropsWithChildren) {
3537
return props.children
3638
}
3739

0 commit comments

Comments
 (0)