File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
packages/plugin-rsc/examples/starter/src/framework Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,15 @@ export async function renderHTML(
2424 // deserialization needs to be kicked off inside ReactDOMServer context
2525 // for ReactDomServer preinit/preloading to work
2626 payload ??= ReactClient . createFromReadableStream < RscPayload > ( rscStream1 )
27- return React . use ( payload ) . root
27+ const root = React . use ( payload ) . root
28+ return < SsrUseWorkaround > { root } </ SsrUseWorkaround >
29+ }
30+
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`)
33+ // https://github.com/facebook/react/issues/33937#issuecomment-3091349011
34+ function SsrUseWorkaround ( props : React . PropsWithChildren ) {
35+ return props . children
2836 }
2937
3038 // render html (traditional SSR)
You can’t perform that action at this time.
0 commit comments