Skip to content

fix(rsc): rename "server" APIs to use "RSC" #13889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/api/rsc/RSCHydratedRouter.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title: RSCHydratedRouter

## Summary

Hydrates a server rendered `ServerPayload` in the browser.
Hydrates a server rendered `RSCPayload` in the browser.

## Props

Expand All @@ -18,7 +18,7 @@ Your `react-server-dom-xyz/client`'s `createFromReadableStream` function, used t

### payload

The decoded ServerPayload to hydrate.
The decoded `RSCPayload` to hydrate.

### routeDiscovery

Expand Down
4 changes: 2 additions & 2 deletions docs/api/rsc/RSCStaticRouter.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ title: RSCStaticRouter

## Summary

Pre-renders a `ServerPayload` to HTML. Usually used in `routeRSCServerRequest`'s `renderHTML` callback.
Pre-renders an `RSCPayload` to HTML. Usually used in `routeRSCServerRequest`'s `renderHTML` callback.

## Props

### getPayload

A function that starts decoding of the ServerPayload. Usually passed through from `routeRSCServerRequest`'s `renderHTML`.
A function that starts decoding of the `RSCPayload`. Usually passed through from `routeRSCServerRequest`'s `renderHTML`.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: getServerStream
title: getRSCStream
---

# getServerStream
# getRSCStream

[MODES: data]

Expand Down
4 changes: 2 additions & 2 deletions docs/api/rsc/matchRSCServerRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title: matchRSCServerRequest

## Summary

Matches the given routes to a Request and returns a RSC Response encoding a `ServerPayload` for consumption by a RSC enabled client router.
Matches the given routes to a Request and returns a RSC Response encoding an `RSCPayload` for consumption by a RSC enabled client router.

## Options

Expand All @@ -26,7 +26,7 @@ A function responsible for decoding form state for progressively enhanceable for

### generateResponse

A function responsible for using your `renderToReadableStream` to generate a Response encoding the `ServerPayload`.
A function responsible for using your `renderToReadableStream` to generate a Response encoding the `RSCPayload`.

### loadServerAction

Expand Down
4 changes: 2 additions & 2 deletions docs/api/rsc/routeRSCServerRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Your `react-server-dom-xyz/client`'s `createFromReadableStream` function, used t

### fetchServer

A function that forwards a `Request` to the RSC handler and returns a `Promise<Response>` containing a serialized `ServerPayload`.
A function that forwards a `Request` to the RSC handler and returns a `Promise<Response>` containing a serialized `RSCPayload`.

### renderHTML

A function that renders the `ServerPayload` to HTML, usually using a `<RSCStaticRouter>`.
A function that renders the `RSCPayload` to HTML, usually using a `<RSCStaticRouter>`.

### request

Expand Down
12 changes: 6 additions & 6 deletions docs/start/rsc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ Create a `src/browser.tsx` file that will act as the entrypoint for hydration.
import { startTransition, StrictMode } from "react";
import { hydrateRoot } from "react-dom/client";
import {
type unstable_ServerPayload as ServerPayload,
type unstable_RSCPayload as RSCPayload,
unstable_createCallServer as createCallServer,
unstable_getServerStream as getServerStream,
unstable_getRSCStream as getRSCStream,
unstable_RSCHydratedRouter as RSCHydratedRouter,
} from "react-router";
import {
Expand All @@ -205,8 +205,8 @@ setServerCallback(
);

// Get and decode the initial server payload
createFromReadableStream(getServerStream()).then(
(payload: ServerPayload) => {
createFromReadableStream(getRSCStream()).then(
(payload: RSCPayload) => {
startTransition(async () => {
hydrateRoot(
document,
Expand All @@ -231,7 +231,7 @@ Create a `src/routes/routes.ts` file that will define our routes with dynamic im
```ts nonumber
"use server-entry";

import type { unstable_ServerRouteObject as ServerRouteObject } from "react-router";
import type { unstable_RSCRouteConfig as RSCRouteConfig } from "react-router";

import "../browser";

Expand All @@ -254,7 +254,7 @@ export function routes() {
},
],
},
] satisfies ServerRouteObject[];
] satisfies RSCRouteConfig;
}
```

Expand Down
2 changes: 1 addition & 1 deletion integration/helpers/rsc-parcel-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@types/react-dom": "^19.0.3",
"@types/react": "^19.0.8",
"parcel": "2.15.0",
"parcel-config-react-router-experimental": "1.0.23",
"parcel-config-react-router-experimental": "1.0.24",
"typescript": "^5.1.6"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions integration/helpers/rsc-parcel/src/browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import { startTransition, StrictMode } from "react";
import { hydrateRoot } from "react-dom/client";
import type { unstable_ServerPayload as ServerPayload } from "react-router";
import type { unstable_RSCPayload as RSCPayload } from "react-router";
import {
unstable_createCallServer as createCallServer,
unstable_getServerStream as getServerStream,
unstable_getRSCStream as getRSCStream,
unstable_RSCHydratedRouter as RSCHydratedRouter,
} from "react-router";
import {
Expand All @@ -24,7 +24,7 @@ setServerCallback(
);

// Get and decode the initial server payload
createFromReadableStream(getServerStream()).then((payload: ServerPayload) => {
createFromReadableStream(getRSCStream()).then((payload: RSCPayload) => {
// @ts-expect-error - on 18 types, requires 19.
startTransition(async () => {
const formState =
Expand Down
4 changes: 2 additions & 2 deletions integration/helpers/rsc-parcel/src/routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { unstable_ServerRouteObject as ServerRouteObject } from "react-router";
import type { unstable_RSCRouteConfig as RSCRouteConfig } from "react-router";

export const routes = [
{
Expand All @@ -13,4 +13,4 @@ export const routes = [
},
],
},
] satisfies ServerRouteObject[];
] satisfies RSCRouteConfig;
6 changes: 3 additions & 3 deletions integration/helpers/rsc-vite/src/entry.browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {
} from "@hiogawa/vite-rsc/browser";
import {
unstable_createCallServer as createCallServer,
unstable_getServerStream as getServerStream,
unstable_getRSCStream as getRSCStream,
unstable_RSCHydratedRouter as RSCHydratedRouter,
} from "react-router";
import type { unstable_ServerPayload as ServerPayload } from "react-router";
import type { unstable_RSCPayload as RSCPayload } from "react-router";

setServerCallback(
createCallServer({
Expand All @@ -19,7 +19,7 @@ setServerCallback(
})
);

createFromReadableStream<ServerPayload>(getServerStream()).then((payload) => {
createFromReadableStream<RSCPayload>(getRSCStream()).then((payload) => {
startTransition(() => {
hydrateRoot(
document,
Expand Down
4 changes: 2 additions & 2 deletions integration/helpers/rsc-vite/src/routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { unstable_ServerRouteObject as ServerRouteObject } from "react-router";
import type { unstable_RSCRouteConfig as RSCRouteConfig } from "react-router";

export const routes = [
{
Expand All @@ -13,4 +13,4 @@ export const routes = [
},
],
},
] satisfies ServerRouteObject[];
] satisfies RSCRouteConfig;
12 changes: 6 additions & 6 deletions integration/rsc/rsc-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ implementations.forEach((implementation) => {
port,
files: {
"src/routes.ts": js`
import type { unstable_ServerRouteObject as ServerRouteObject } from "react-router";
import type { unstable_RSCRouteConfig as RSCRouteConfig } from "react-router";

export const routes = [
{
Expand All @@ -229,7 +229,7 @@ implementations.forEach((implementation) => {
},
],
},
] satisfies ServerRouteObject[];
] satisfies RSCRouteConfig;
`,
"src/routes/home.tsx": js`
import { Link } from "react-router";
Expand Down Expand Up @@ -340,7 +340,7 @@ implementations.forEach((implementation) => {
port,
files: {
"src/routes.ts": js`
import type { unstable_ServerRouteObject as ServerRouteObject } from "react-router";
import type { unstable_RSCRouteConfig as RSCRouteConfig } from "react-router";

export const routes = [
{
Expand All @@ -360,7 +360,7 @@ implementations.forEach((implementation) => {
},
],
},
] satisfies ServerRouteObject[];
] satisfies RSCRouteConfig;
`,
"src/routes/home.tsx": js`
import { Link } from "react-router";
Expand Down Expand Up @@ -473,7 +473,7 @@ implementations.forEach((implementation) => {
port,
files: {
"src/routes.ts": js`
import type { unstable_ServerRouteObject as ServerRouteObject } from "react-router";
import type { unstable_RSCRouteConfig as RSCRouteConfig } from "react-router";

export const routes = [
{
Expand All @@ -493,7 +493,7 @@ implementations.forEach((implementation) => {
path: "resource",
lazy: () => import("./routes/resource"),
},
] satisfies ServerRouteObject[];
] satisfies RSCRouteConfig;
`,
"src/routes/resource.tsx": js`
export function loader() {
Expand Down
15 changes: 8 additions & 7 deletions packages/react-router/index-react-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ export type {
DecodeFormStateFunction as unstable_DecodeFormStateFunction,
DecodeReplyFunction as unstable_DecodeReplyFunction,
LoadServerActionFunction as unstable_LoadServerActionFunction,
ServerManifestPayload as unstable_ServerManifestPayload,
ServerMatch as unstable_ServerMatch,
ServerPayload as unstable_ServerPayload,
ServerRenderPayload as unstable_ServerRenderPayload,
RenderedRoute as ServerRouteManifest,
ServerRouteMatch as unstable_ServerRouteMatch,
ServerRouteObject as unstable_ServerRouteObject,
RSCManifestPayload as unstable_RSCManifestPayload,
RSCMatch as unstable_RSCMatch,
RSCPayload as unstable_RSCPayload,
RSCRenderPayload as unstable_RSCRenderPayload,
RSCRouteManifest as unstable_RSCRouteManifest,
RSCRouteMatch as unstable_RSCRouteMatch,
RSCRouteConfigEntry as unstable_RSCRouteConfigEntry,
RSCRouteConfig as unstable_RSCRouteConfig,
} from "./lib/rsc/server.rsc";

// RSC implementation of agnostic APIs
Expand Down
17 changes: 9 additions & 8 deletions packages/react-router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export {
routeRSCServerRequest as unstable_routeRSCServerRequest,
RSCStaticRouter as unstable_RSCStaticRouter,
} from "./lib/rsc/server.ssr";
export { getServerStream as unstable_getServerStream } from "./lib/rsc/html-stream/browser";
export { getRSCStream as unstable_getRSCStream } from "./lib/rsc/html-stream/browser";
export { RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary } from "./lib/rsc/errorBoundaries";

// Re-export of RSC types
Expand All @@ -305,13 +305,14 @@ export type {
DecodeFormStateFunction as unstable_DecodeFormStateFunction,
DecodeReplyFunction as unstable_DecodeReplyFunction,
LoadServerActionFunction as unstable_LoadServerActionFunction,
ServerManifestPayload as unstable_ServerManifestPayload,
ServerMatch as unstable_ServerMatch,
ServerPayload as unstable_ServerPayload,
ServerRenderPayload as unstable_ServerRenderPayload,
RenderedRoute as ServerRouteManifest,
ServerRouteMatch as unstable_ServerRouteMatch,
ServerRouteObject as unstable_ServerRouteObject,
RSCManifestPayload as unstable_RSCManifestPayload,
RSCMatch as unstable_RSCMatch,
RSCPayload as unstable_RSCPayload,
RSCRenderPayload as unstable_RSCRenderPayload,
RSCRouteManifest as unstable_RSCRouteManifest,
RSCRouteMatch as unstable_RSCRouteMatch,
RSCRouteConfigEntry as unstable_RSCRouteConfigEntry,
RSCRouteConfig as unstable_RSCRouteConfig,
} from "./lib/rsc/server.rsc";

///////////////////////////////////////////////////////////////////////////////
Expand Down
Loading