Skip to content

Commit 3a64889

Browse files
committed
Add name field to ReactIOInfo
1 parent 66aedcc commit 3a64889

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

packages/react-client/src/ReactFlightClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ function nullRefGetter() {
675675
}
676676

677677
function getIOInfoTaskName(ioInfo: ReactIOInfo): string {
678-
return ''; // TODO
678+
return ioInfo.name;
679679
}
680680

681681
function getAsyncInfoTaskName(asyncInfo: ReactAsyncInfo): string {

packages/react-server/src/ReactFlightServer.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3496,6 +3496,7 @@ function outlineComponentInfo(
34963496
function emitIOInfoChunk(
34973497
request: Request,
34983498
id: number,
3499+
name: string,
34993500
start: number,
35003501
end: number,
35013502
stack: ?ReactStackTrace,
@@ -3532,6 +3533,7 @@ function emitIOInfoChunk(
35323533
const relativeStartTimestamp = start - request.timeOrigin;
35333534
const relativeEndTimestamp = end - request.timeOrigin;
35343535
const debugIOInfo: Omit<ReactIOInfo, 'debugTask' | 'debugStack'> = {
3536+
name: name,
35353537
start: relativeStartTimestamp,
35363538
end: relativeEndTimestamp,
35373539
stack: stack,
@@ -3551,7 +3553,14 @@ function outlineIOInfo(request: Request, ioInfo: ReactIOInfo): void {
35513553
// We can't serialize the ConsoleTask/Error objects so we need to omit them before serializing.
35523554
request.pendingChunks++;
35533555
const id = request.nextChunkId++;
3554-
emitIOInfoChunk(request, id, ioInfo.start, ioInfo.end, ioInfo.stack);
3556+
emitIOInfoChunk(
3557+
request,
3558+
id,
3559+
ioInfo.name,
3560+
ioInfo.start,
3561+
ioInfo.end,
3562+
ioInfo.stack,
3563+
);
35553564
request.writtenObjects.set(ioInfo, serializeByValueID(id));
35563565
}
35573566

@@ -3566,12 +3575,14 @@ function serializeIONode(
35663575
}
35673576

35683577
let stack = null;
3578+
let name = '';
35693579
if (ioNode.stack !== null) {
35703580
stack = filterStackTrace(request, ioNode.stack, 1);
3581+
name = '';
35713582
}
35723583
request.pendingChunks++;
35733584
const id = request.nextChunkId++;
3574-
emitIOInfoChunk(request, id, ioNode.start, ioNode.end, stack);
3585+
emitIOInfoChunk(request, id, name, ioNode.start, ioNode.end, stack);
35753586
const ref = serializeByValueID(id);
35763587
request.writtenObjects.set(ioNode, ref);
35773588
return ref;

packages/shared/ReactTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ export type ReactErrorInfo = ReactErrorInfoProd | ReactErrorInfoDev;
231231

232232
// The point where the Async Info started which might not be the same place it was awaited.
233233
export type ReactIOInfo = {
234+
+name: string, // the name of the async function being called (e.g. "fetch")
234235
+start: number, // the start time
235236
+end: number, // the end time (this might be different from the time the await was unblocked)
236237
+stack?: null | ReactStackTrace,

0 commit comments

Comments
 (0)