File tree Expand file tree Collapse file tree 10 files changed +20
-17
lines changed Expand file tree Collapse file tree 10 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ export async function prerender(
160160 // How to fetch from the React Server.
161161 fetchServer ,
162162 // Provide the React Server touchpoints.
163- decode: createFromReadableStream ,
163+ createFromReadableStream ,
164164 // Render the router to HTML.
165165 async renderHTML(getPayload ) {
166166 return await renderHTMLToReadableStream (
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export async function prerender(
1818 // How to fetch from the React Server.
1919 fetchServer,
2020 // Provide the React Server touchpoints.
21- decode : createFromReadableStream ,
21+ createFromReadableStream,
2222 // Render the router to HTML.
2323 async renderHTML ( getPayload ) {
2424 const payload = await getPayload ( ) ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export default async function handler(
1414 return routeRSCServerRequest ( {
1515 request,
1616 fetchServer,
17- decode : ( body ) => createFromReadableStream ( body ) ,
17+ createFromReadableStream,
1818 renderHTML ( getPayload ) {
1919 return ReactDomServer . renderToReadableStream (
2020 < RSCStaticRouter getPayload = { getPayload } /> ,
Original file line number Diff line number Diff line change 22export { matchRSCServerRequest as unstable_matchRSCServerRequest } from "./lib/rsc/server.rsc" ;
33
44export type {
5+ CreateFromReadableStreamFunction as unstable_CreateFromReadableStreamFunction ,
56 DecodeActionFunction as unstable_DecodeActionFunction ,
67 DecodeFormStateFunction as unstable_DecodeFormStateFunction ,
78 DecodeReplyFunction as unstable_DecodeReplyFunction ,
Original file line number Diff line number Diff line change @@ -283,10 +283,7 @@ export type { Register } from "./lib/types/register";
283283export { href } from "./lib/href" ;
284284
285285// RSC
286- export type {
287- CreateFromReadableStreamFunction as unstable_CreateFromReadableStreamFunction ,
288- EncodeReplyFunction as unstable_EncodeReplyFunction ,
289- } from "./lib/rsc/browser" ;
286+ export type { EncodeReplyFunction as unstable_EncodeReplyFunction } from "./lib/rsc/browser" ;
290287export {
291288 createCallServer as unstable_createCallServer ,
292289 RSCHydratedRouter as unstable_RSCHydratedRouter ,
@@ -303,6 +300,7 @@ import type { matchRSCServerRequest } from "./lib/rsc/server.rsc";
303300export declare const unstable_matchRSCServerRequest : typeof matchRSCServerRequest ;
304301
305302export type {
303+ CreateFromReadableStreamFunction as unstable_CreateFromReadableStreamFunction ,
306304 DecodeActionFunction as unstable_DecodeActionFunction ,
307305 DecodeFormStateFunction as unstable_DecodeFormStateFunction ,
308306 DecodeReplyFunction as unstable_DecodeReplyFunction ,
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import type {
1616 ServerPayload ,
1717 RenderedRoute ,
1818 ServerRenderPayload ,
19+ CreateFromReadableStreamFunction ,
1920} from "./server.rsc" ;
2021import type {
2122 DataStrategyFunction ,
@@ -40,10 +41,6 @@ import {
4041} from "../dom/ssr/routes" ;
4142import { RSCRouterGlobalErrorBoundary } from "./errorBoundaries" ;
4243
43- export type CreateFromReadableStreamFunction = (
44- body : ReadableStream < Uint8Array >
45- ) => Promise < unknown > ;
46-
4744export type EncodeReplyFunction = ( args : unknown [ ] ) => Promise < BodyInit > ;
4845
4946declare global {
Original file line number Diff line number Diff line change @@ -35,6 +35,10 @@ import { SINGLE_FETCH_REDIRECT_STATUS } from "../dom/ssr/single-fetch";
3535import type { RouteMatch , RouteObject } from "../context" ;
3636import invariant from "../server-runtime/invariant" ;
3737
38+ export type CreateFromReadableStreamFunction = (
39+ body : ReadableStream < Uint8Array >
40+ ) => Promise < unknown > ;
41+
3842type ServerContext = {
3943 redirect ?: Response ;
4044} ;
Original file line number Diff line number Diff line change @@ -5,18 +5,21 @@ import type { FrameworkContextObject } from "../dom/ssr/entry";
55import { createStaticRouter , StaticRouterProvider } from "../dom/server" ;
66import { injectRSCPayload } from "./html-stream/server" ;
77import { RSCRouterGlobalErrorBoundary } from "./errorBoundaries" ;
8- import type { ServerPayload } from "./server.rsc" ;
8+ import type {
9+ ServerPayload ,
10+ CreateFromReadableStreamFunction ,
11+ } from "./server.rsc" ;
912
1013export async function routeRSCServerRequest ( {
1114 request,
1215 fetchServer,
13- decode ,
16+ createFromReadableStream ,
1417 renderHTML,
1518 hydrate = true ,
1619} : {
1720 request : Request ;
1821 fetchServer : ( request : Request ) => Promise < Response > ;
19- decode : ( body : ReadableStream < Uint8Array > ) => Promise < ServerPayload > ;
22+ createFromReadableStream : CreateFromReadableStreamFunction ;
2023 renderHTML : (
2124 getPayload : ( ) => Promise < ServerPayload >
2225 ) => ReadableStream < Uint8Array > | Promise < ReadableStream < Uint8Array > > ;
@@ -51,7 +54,7 @@ export async function routeRSCServerRequest({
5154 let payloadPromise : Promise < ServerPayload > ;
5255 const getPayload = async ( ) => {
5356 if ( payloadPromise ) return payloadPromise ;
54- payloadPromise = decode ( body ) ;
57+ payloadPromise = createFromReadableStream ( body ) as Promise < ServerPayload > ;
5558 return payloadPromise ;
5659 } ;
5760
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ app.use(
2020 return routeRSCServerRequest ( {
2121 request,
2222 fetchServer,
23- decode : createFromReadableStream ,
23+ createFromReadableStream,
2424 async renderHTML ( getPayload ) {
2525 return await renderHTMLToReadableStream (
2626 < RSCStaticRouter getPayload = { getPayload } /> ,
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export default async function handler(
1414 return routeRSCServerRequest ( {
1515 request,
1616 fetchServer,
17- decode : ( body ) => createFromReadableStream ( body ) ,
17+ createFromReadableStream,
1818 renderHTML ( getPayload ) {
1919 return ReactDomServer . renderToReadableStream (
2020 < RSCStaticRouter getPayload = { getPayload } /> ,
You can’t perform that action at this time.
0 commit comments