Skip to content

Commit d520b82

Browse files
committed
Rename processReferenceChunk to encodeReferenceChunk
This one still is around and is kind of a special case.
1 parent c173294 commit d520b82

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

packages/react-server/src/ReactFlightServer.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,20 @@ function serializeBigInt(n: bigint): string {
628628
return '$n' + n.toString(10);
629629
}
630630

631+
function serializeRowHeader(tag: string, id: number) {
632+
return id.toString(16) + ':' + tag;
633+
}
634+
635+
function encodeReferenceChunk(
636+
request: Request,
637+
id: number,
638+
reference: string,
639+
): Chunk {
640+
const json = stringify(reference);
641+
const row = id.toString(16) + ':' + json + '\n';
642+
return stringToChunk(row);
643+
}
644+
631645
function serializeClientReference(
632646
request: Request,
633647
parent:
@@ -1208,7 +1222,7 @@ function emitHintChunk(request: Request, code: string, model: HintModel): void {
12081222

12091223
function emitSymbolChunk(request: Request, id: number, name: string): void {
12101224
const symbolReference = serializeSymbolReference(name);
1211-
const processedChunk = processReferenceChunk(request, id, symbolReference);
1225+
const processedChunk = encodeReferenceChunk(request, id, symbolReference);
12121226
request.completedImportChunks.push(processedChunk);
12131227
}
12141228

@@ -1218,7 +1232,7 @@ function emitProviderChunk(
12181232
contextName: string,
12191233
): void {
12201234
const contextReference = serializeProviderReference(contextName);
1221-
const processedChunk = processReferenceChunk(request, id, contextReference);
1235+
const processedChunk = encodeReferenceChunk(request, id, contextReference);
12221236
request.completedRegularChunks.push(processedChunk);
12231237
}
12241238

@@ -1355,7 +1369,7 @@ function abortTask(task: Task, request: Request, errorId: number): void {
13551369
// Instead of emitting an error per task.id, we emit a model that only
13561370
// has a single value referencing the error.
13571371
const ref = serializeByValueID(errorId);
1358-
const processedChunk = processReferenceChunk(request, task.id, ref);
1372+
const processedChunk = encodeReferenceChunk(request, task.id, ref);
13591373
request.completedErrorChunks.push(processedChunk);
13601374
}
13611375

@@ -1528,17 +1542,3 @@ function importServerContexts(
15281542
}
15291543
return rootContextSnapshot;
15301544
}
1531-
1532-
function serializeRowHeader(tag: string, id: number) {
1533-
return id.toString(16) + ':' + tag;
1534-
}
1535-
1536-
function processReferenceChunk(
1537-
request: Request,
1538-
id: number,
1539-
reference: string,
1540-
): Chunk {
1541-
const json = stringify(reference);
1542-
const row = id.toString(16) + ':' + json + '\n';
1543-
return stringToChunk(row);
1544-
}

0 commit comments

Comments
 (0)