File tree Expand file tree Collapse file tree 3 files changed +18
-17
lines changed
packages/plugin-rsc/examples
starter-cf-single/src/framework Expand file tree Collapse file tree 3 files changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -32,11 +32,12 @@ export default async function handler(request: Request): Promise<Response> {
3232 }
3333 }
3434
35- const rscStream = ReactServer . renderToReadableStream < RscPayload > ( {
36- root : < Root /> ,
37- returnValue,
38- formState,
39- } )
35+ const rscPayload : RscPayload = { root : < Root /> , formState, returnValue }
36+ const rscOptions = { temporaryReferences }
37+ const rscStream = ReactServer . renderToReadableStream < RscPayload > (
38+ rscPayload ,
39+ rscOptions ,
40+ )
4041
4142 return new Response ( rscStream , {
4243 headers : {
Original file line number Diff line number Diff line change @@ -41,12 +41,12 @@ async function handler(request: Request): Promise<Response> {
4141 // we render RSC stream after handling server function request
4242 // so that new render reflects updated state from server function call
4343 // to achieve single round trip to mutate and fetch from server.
44- const rscStream = ReactServer . renderToReadableStream < RscPayload > ( {
45- // in this example, we always render the same `<Root />`
46- root : < Root /> ,
47- returnValue ,
48- formState ,
49- } )
44+ const rscPayload : RscPayload = { root : < Root /> , formState , returnValue }
45+ const rscOptions = { temporaryReferences }
46+ const rscStream = ReactServer . renderToReadableStream < RscPayload > (
47+ rscPayload ,
48+ rscOptions ,
49+ )
5050
5151 // respond RSC stream without HTML rendering based on framework's convention.
5252 // here we use request header `content-type`.
Original file line number Diff line number Diff line change @@ -51,12 +51,12 @@ export default async function handler(request: Request): Promise<Response> {
5151 // we render RSC stream after handling server function request
5252 // so that new render reflects updated state from server function call
5353 // to achieve single round trip to mutate and fetch from server.
54- const rscStream = ReactServer . renderToReadableStream < RscPayload > ( {
55- // in this example, we always render the same `<Root />`
56- root : < Root /> ,
57- returnValue ,
58- formState ,
59- } )
54+ const rscPayload : RscPayload = { root : < Root /> , formState , returnValue }
55+ const rscOptions = { temporaryReferences }
56+ const rscStream = ReactServer . renderToReadableStream < RscPayload > (
57+ rscPayload ,
58+ rscOptions ,
59+ )
6060
6161 // respond RSC stream without HTML rendering based on framework's convention.
6262 // here we use request header `content-type`.
You can’t perform that action at this time.
0 commit comments