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> {
32
32
}
33
33
}
34
34
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
+ )
40
41
41
42
return new Response ( rscStream , {
42
43
headers : {
Original file line number Diff line number Diff line change @@ -41,12 +41,12 @@ async function handler(request: Request): Promise<Response> {
41
41
// we render RSC stream after handling server function request
42
42
// so that new render reflects updated state from server function call
43
43
// 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
+ )
50
50
51
51
// respond RSC stream without HTML rendering based on framework's convention.
52
52
// 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> {
51
51
// we render RSC stream after handling server function request
52
52
// so that new render reflects updated state from server function call
53
53
// 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
+ )
60
60
61
61
// respond RSC stream without HTML rendering based on framework's convention.
62
62
// here we use request header `content-type`.
You can’t perform that action at this time.
0 commit comments