Skip to content

Commit af37ceb

Browse files
committed
Don't replay performance logs when replayConsoleLogs is false
1 parent d2a288f commit af37ceb

File tree

1 file changed

+36
-30
lines changed

1 file changed

+36
-30
lines changed

packages/react-client/src/ReactFlightClient.js

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -702,14 +702,16 @@ export function reportGlobalError(response: Response, error: Error): void {
702702
}
703703
}
704704
if (enableProfilerTimer && enableComponentPerformanceTrack) {
705-
markAllTracksInOrder();
706-
flushComponentPerformance(
707-
response,
708-
getChunk(response, 0),
709-
0,
710-
-Infinity,
711-
-Infinity,
712-
);
705+
if (response._replayConsole) {
706+
markAllTracksInOrder();
707+
flushComponentPerformance(
708+
response,
709+
getChunk(response, 0),
710+
0,
711+
-Infinity,
712+
-Infinity,
713+
);
714+
}
713715
}
714716
}
715717

@@ -1817,7 +1819,9 @@ function ResponseInstance(
18171819
if (enableProfilerTimer && enableComponentPerformanceTrack) {
18181820
// Since we don't know when recording of profiles will start and stop, we have to
18191821
// mark the order over and over again.
1820-
markAllTracksInOrder();
1822+
if (replayConsole) {
1823+
markAllTracksInOrder();
1824+
}
18211825
}
18221826

18231827
// Don't inline this call because it causes closure to outline the call above.
@@ -2942,28 +2946,30 @@ function initializeIOInfo(response: Response, ioInfo: ReactIOInfo): void {
29422946
// $FlowFixMe[cannot-write]
29432947
ioInfo.end += response._timeOrigin;
29442948

2945-
const env = response._rootEnvironmentName;
2946-
const promise = ioInfo.value;
2947-
if (promise) {
2948-
const thenable: Thenable<mixed> = (promise: any);
2949-
switch (thenable.status) {
2950-
case INITIALIZED:
2951-
logIOInfo(ioInfo, env, thenable.value);
2952-
break;
2953-
case ERRORED:
2954-
logIOInfoErrored(ioInfo, env, thenable.reason);
2955-
break;
2956-
default:
2957-
// If we haven't resolved the Promise yet, wait to log until have so we can include
2958-
// its data in the log.
2959-
promise.then(
2960-
logIOInfo.bind(null, ioInfo, env),
2961-
logIOInfoErrored.bind(null, ioInfo, env),
2962-
);
2963-
break;
2949+
if (response._replayConsole) {
2950+
const env = response._rootEnvironmentName;
2951+
const promise = ioInfo.value;
2952+
if (promise) {
2953+
const thenable: Thenable<mixed> = (promise: any);
2954+
switch (thenable.status) {
2955+
case INITIALIZED:
2956+
logIOInfo(ioInfo, env, thenable.value);
2957+
break;
2958+
case ERRORED:
2959+
logIOInfoErrored(ioInfo, env, thenable.reason);
2960+
break;
2961+
default:
2962+
// If we haven't resolved the Promise yet, wait to log until have so we can include
2963+
// its data in the log.
2964+
promise.then(
2965+
logIOInfo.bind(null, ioInfo, env),
2966+
logIOInfoErrored.bind(null, ioInfo, env),
2967+
);
2968+
break;
2969+
}
2970+
} else {
2971+
logIOInfo(ioInfo, env, undefined);
29642972
}
2965-
} else {
2966-
logIOInfo(ioInfo, env, undefined);
29672973
}
29682974
}
29692975

0 commit comments

Comments
 (0)