Skip to content

Commit 966be76

Browse files
authored
chore(rsc): Rename rsf -> rsa (#11391)
1 parent 09d090f commit 966be76

File tree

8 files changed

+22
-24
lines changed

8 files changed

+22
-24
lines changed

packages/router/src/rsc/rscFetchForClientRouter.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ export function rscFetch(rscId: string, props: RscFetchProps) {
3939
// element). So for now at least we need to send it with every RSC
4040
// request, so React knows what `callServer` method to use for server
4141
// actions inside the RSC.
42-
callServer: async function (rsfId: string, args: unknown[]) {
42+
callServer: async function (rsaId: string, args: unknown[]) {
4343
// `args` is often going to be an array with just a single element,
4444
// and that element will be FormData
45-
console.log('ClientRouter.ts :: callServer rsfId', rsfId, 'args', args)
45+
console.log('ClientRouter.ts :: callServer rsfId', rsaId, 'args', args)
4646

4747
const searchParams = new URLSearchParams()
48-
searchParams.set('action_id', rsfId)
48+
searchParams.set('action_id', rsaId)
4949
const id = '_'
5050

5151
const response = fetch(BASE_PATH + id + '?' + searchParams, {

packages/vite/src/buildRscClientAndServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const buildRscClientAndServer = async ({
1111
}: {
1212
verbose?: boolean
1313
}) => {
14-
// Analyze all files and generate a list of RSCs and RSFs
14+
// Analyze all files and generate a list of RSCs and RSAs
1515
const { clientEntryFiles, serverEntryFiles } = await rscBuildAnalyze()
1616

1717
// Generate the client bundle

packages/vite/src/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ function fetchRSC(
4848
// element). So for now at least we need to send it with every RSC
4949
// request, so React knows what `callServer` method to use for server
5050
// actions inside the RSC.
51-
callServer: async function (rsfId: string, args: unknown[]) {
51+
callServer: async function (rsaId: string, args: unknown[]) {
5252
// `args` is often going to be an array with just a single element,
5353
// and that element will be FormData
54-
console.log('client.ts :: callServer rsfId', rsfId, 'args', args)
54+
console.log('client.ts :: callServer rsfId', rsaId, 'args', args)
5555

5656
const isMutating = !!mutationMode
5757
const searchParams = new URLSearchParams()
58-
searchParams.set('action_id', rsfId)
58+
searchParams.set('action_id', rsaId)
5959
let id: string
6060

6161
if (isMutating) {

packages/vite/src/rsc/rscBuildAnalyze.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { rscAnalyzePlugin } from '../plugins/vite-plugin-rsc-analyze.js'
1111
* buildFeServer -> buildRscFeServer -> rscBuildAnalyze
1212
* Uses rscAnalyzePlugin to collect client and server entry points
1313
* Starts building the AST in entries.ts
14-
* Doesn't output any files, only collects a list of RSCs and RSFs
14+
* Doesn't output any files, only collects a list of RSCs and RSAs
1515
*/
1616
export async function rscBuildAnalyze() {
1717
console.log('\n')

packages/vite/src/rsc/rscRequestHandler.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ export function createRscRequestHandler(
3434
) {
3535
// This is mounted at /rw-rsc, so will have /rw-rsc stripped from req.url
3636

37-
// above this line is for ALL users ☝️, not a per request basis
38-
// -------------
3937
return async (
4038
req: ExpressRequest,
4139
res: ExpressResponse,
@@ -96,23 +94,23 @@ export function createRscRequestHandler(
9694
const props: RscFetchProps = JSON.parse(
9795
url.searchParams.get('props') || '{}',
9896
)
99-
let rsfId: string | undefined
97+
let rsaId: string | undefined
10098
let args: unknown[] = []
10199

102100
if (url.pathname.startsWith(basePath)) {
103101
rscId = url.pathname.split('/').pop()
104-
rsfId = url.searchParams.get('action_id') || undefined
102+
rsaId = url.searchParams.get('action_id') || undefined
105103

106104
console.log('rscId', rscId)
107-
console.log('rsfId', rsfId)
105+
console.log('rsaId', rsaId)
108106

109107
if (rscId && rscId !== '_') {
110108
res.setHeader('Content-Type', 'text/x-component')
111109
} else {
112110
rscId = undefined
113111
}
114112

115-
if (rsfId) {
113+
if (rsaId) {
116114
// TODO (RSC): For React Server Actions we need to limit the request
117115
// size somehow
118116
// https://nextjs.org/docs/app/api-reference/functions/server-actions#size-limitation
@@ -167,7 +165,7 @@ export function createRscRequestHandler(
167165

168166
console.log('rscRequestHandler: args', args)
169167

170-
if (rscId || rsfId) {
168+
if (rscId || rsaId) {
171169
const handleError = (err: unknown) => {
172170
if (hasStatusCode(err)) {
173171
res.statusCode = err.statusCode
@@ -198,7 +196,7 @@ export function createRscRequestHandler(
198196
const pipeable = renderRsc({
199197
rscId,
200198
props,
201-
rsfId,
199+
rsaId,
202200
args,
203201
// Pass the serverState from server to the worker
204202
// Inside the worker, we'll use this to re-initalize the server state (because workers are stateless)
@@ -212,7 +210,7 @@ export function createRscRequestHandler(
212210
await sendRscFlightToStudio({
213211
rscId,
214212
props,
215-
rsfId,
213+
rsaId,
216214
args,
217215
basePath,
218216
req,

packages/vite/src/rsc/rscStudioHandlers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const sendRscFlightToStudio = async (input: StudioRenderInput) => {
129129
console.debug('Studio is not enabled')
130130
return
131131
}
132-
const { rscId, props, rsfId, args, basePath, req, handleError } = input
132+
const { rscId, props, rsaId, args, basePath, req, handleError } = input
133133

134134
try {
135135
// surround renderRsc with performance metrics
@@ -144,7 +144,7 @@ export const sendRscFlightToStudio = async (input: StudioRenderInput) => {
144144
const pipeable = renderRsc({
145145
rscId,
146146
props,
147-
rsfId,
147+
rsaId,
148148
args,
149149
serverState: {
150150
headersInit: Object.fromEntries(getRequestHeaders().entries()),
@@ -160,7 +160,7 @@ export const sendRscFlightToStudio = async (input: StudioRenderInput) => {
160160
const metadata = {
161161
rsc: {
162162
rscId,
163-
rsfId,
163+
rsaId,
164164
props,
165165
args,
166166
},

packages/vite/src/rsc/rscWorker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ function getBundlerConfig(config: ConfigType) {
384384
}
385385

386386
async function renderRsc(input: RenderInput): Promise<PipeableStream> {
387-
if (input.rsfId || !input.args) {
387+
if (input.rsaId || !input.args) {
388388
throw new Error(
389389
"Unexpected input. Can't request both RSCs and execute RSAs at the same time.",
390390
)
@@ -424,11 +424,11 @@ function isSerializedFormData(data?: unknown): data is SerializedFormData {
424424
async function handleRsa(input: RenderInput): Promise<PipeableStream> {
425425
console.log('handleRsa input', input)
426426

427-
if (!input.rsfId || !input.args) {
427+
if (!input.rsaId || !input.args) {
428428
throw new Error('Unexpected input')
429429
}
430430

431-
const [fileName, actionName] = input.rsfId.split('#')
431+
const [fileName, actionName] = input.rsaId.split('#')
432432
console.log('Server Action fileName', fileName, 'actionName', actionName)
433433
const module = await loadServerFile(fileName)
434434

packages/vite/src/rsc/rscWorkerCommunication.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const worker = new Worker(workerPath, {
2626
export type RenderInput = {
2727
rscId?: string | undefined
2828
props: RscFetchProps | Record<string, unknown>
29-
rsfId?: string | undefined
29+
rsaId?: string | undefined
3030
args?: unknown[] | undefined
3131
serverState: {
3232
headersInit: Record<string, string>

0 commit comments

Comments
 (0)