Skip to content

Commit a906e38

Browse files
committed
Gate on enableAsyncDebugInfo flag and not just enableComponentPerformanceTrack
We rely on enableComponentPerformanceTrack flag for the timing tracking in general but then we additionally need the async debug info flag to use the async tracking.
1 parent 27855af commit a906e38

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

packages/react-server/src/ReactFlightServer.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
enableTaint,
2020
enableProfilerTimer,
2121
enableComponentPerformanceTrack,
22+
enableAsyncDebugInfo,
2223
} from 'shared/ReactFeatureFlags';
2324

2425
import {
@@ -1953,9 +1954,11 @@ function pingTask(request: Request, task: Task): void {
19531954
if (enableProfilerTimer && enableComponentPerformanceTrack) {
19541955
// If this was async we need to emit the time when it completes.
19551956
task.timed = true;
1956-
const sequence = getCurrentAsyncSequence();
1957-
if (sequence !== null) {
1958-
emitAsyncSequence(request, task, sequence, task.time);
1957+
if (enableAsyncDebugInfo) {
1958+
const sequence = getCurrentAsyncSequence();
1959+
if (sequence !== null) {
1960+
emitAsyncSequence(request, task, sequence, task.time);
1961+
}
19591962
}
19601963
}
19611964
const pingedTasks = request.pingedTasks;

packages/react-server/src/__tests__/ReactFlightAsyncDebugInfo-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ describe('ReactFlightAsyncDebugInfo', () => {
149149
expect(await result).toBe('hi');
150150
getDebugInfo(result);
151151
/*
152-
if (__DEV__ && gate(flags => flags.enableComponentPerformanceTrack)) {
152+
if (__DEV__ && gate(flags => flags.enableComponentPerformanceTrack && flags.enableAsyncDebugInfo)) {
153153
expect(getDebugInfo(result)).toMatchInlineSnapshot(`
154154
[
155155
{
@@ -307,7 +307,7 @@ describe('ReactFlightAsyncDebugInfo', () => {
307307
expect(await result).toBe('hi');
308308
getDebugInfo(result);
309309
/*
310-
if (__DEV__ && gate(flags => flags.enableComponentPerformanceTrack)) {
310+
if (__DEV__ && gate(flags => flags.enableComponentPerformanceTrack && flags.enableAsyncDebugInfo)) {
311311
expect().toMatchInlineSnapshot(`
312312
[
313313
{

0 commit comments

Comments
 (0)