Skip to content

Commit 22e5398

Browse files
authored
chore(rsc): fix temporary references in examples (#603)
1 parent 8e0e8b6 commit 22e5398

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff 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: {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff 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`.

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff 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`.

0 commit comments

Comments
 (0)