Skip to content

Commit 4686872

Browse files
authored
Log passive commit phase when it wasn't delayed (#31526)
Fixes a bug. We're supposed to not log "Waiting for Paint" if the passive effect phase was forced since we weren't really waiting until the paint. Instead we just log an empty string when we force it to still ensure continuity. We should always log the passive phase. This check was in the wrong place.
1 parent 5d89471 commit 4686872

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

packages/react-reconciler/src/ReactFiberPerformanceTrack.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,19 @@ export function logCommitPhase(startTime: number, endTime: number): void {
221221
}
222222
}
223223

224-
export function logPaintYieldPhase(startTime: number, endTime: number): void {
224+
export function logPaintYieldPhase(
225+
startTime: number,
226+
endTime: number,
227+
delayedUntilPaint: boolean,
228+
): void {
225229
if (supportsUserTiming) {
226230
reusableLaneDevToolDetails.color = 'secondary-light';
227231
reusableLaneOptions.start = startTime;
228232
reusableLaneOptions.end = endTime;
229-
performance.measure('Waiting for Paint', reusableLaneOptions);
233+
performance.measure(
234+
delayedUntilPaint ? 'Waiting for Paint' : '',
235+
reusableLaneOptions,
236+
);
230237
}
231238
}
232239

packages/react-reconciler/src/ReactFiberWorkLoop.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -3550,7 +3550,11 @@ function flushPassiveEffectsImpl(wasDelayedCommit: void | boolean) {
35503550
let passiveEffectStartTime = 0;
35513551
if (enableProfilerTimer && enableComponentPerformanceTrack) {
35523552
passiveEffectStartTime = now();
3553-
logPaintYieldPhase(commitEndTime, passiveEffectStartTime);
3553+
logPaintYieldPhase(
3554+
commitEndTime,
3555+
passiveEffectStartTime,
3556+
!!wasDelayedCommit,
3557+
);
35543558
}
35553559

35563560
if (enableSchedulingProfiler) {
@@ -3587,9 +3591,7 @@ function flushPassiveEffectsImpl(wasDelayedCommit: void | boolean) {
35873591

35883592
if (enableProfilerTimer && enableComponentPerformanceTrack) {
35893593
const passiveEffectsEndTime = now();
3590-
if (wasDelayedCommit) {
3591-
logPassiveCommitPhase(passiveEffectStartTime, passiveEffectsEndTime);
3592-
}
3594+
logPassiveCommitPhase(passiveEffectStartTime, passiveEffectsEndTime);
35933595
finalizeRender(lanes, passiveEffectsEndTime);
35943596
}
35953597

0 commit comments

Comments
 (0)