@samitouri / QOS-React / commits / 4686872159

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.

Sebastian Markbåge committed Nov 14, 2024 at 16:30 UTC 4686872159e357accd092b195fb5cafceb980ac8
2 files changed +15 -6
packages/react-reconciler/src/ReactFiberPerformanceTrack.js
+9 -2
@@ -221,12 +221,19 @@ export function logCommitPhase(startTime: number, endTime: number): void {
221 }
222 }
223
224 -export function logPaintYieldPhase(startTime: number, endTime: number): void {
224 +export function logPaintYieldPhase(
225 + startTime: number,
226 + endTime: number,
227 + delayedUntilPaint: boolean,
228 +): void {
229 if (supportsUserTiming) {
230 reusableLaneDevToolDetails.color = 'secondary-light';
231 reusableLaneOptions.start = startTime;
232 reusableLaneOptions.end = endTime;
229 - performance.measure('Waiting for Paint', reusableLaneOptions);
233 + performance.measure(
234 + delayedUntilPaint ? 'Waiting for Paint' : '',
235 + reusableLaneOptions,
236 + );
237 }
238 }
239
packages/react-reconciler/src/ReactFiberWorkLoop.js
+6 -4
@@ -3550,7 +3550,11 @@ function flushPassiveEffectsImpl(wasDelayedCommit: void | boolean) {
3550 let passiveEffectStartTime = 0;
3551 if (enableProfilerTimer && enableComponentPerformanceTrack) {
3552 passiveEffectStartTime = now();
3553 - logPaintYieldPhase(commitEndTime, passiveEffectStartTime);
3553 + logPaintYieldPhase(
3554 + commitEndTime,
3555 + passiveEffectStartTime,
3556 + !!wasDelayedCommit,
3557 + );
3558 }
3559
3560 if (enableSchedulingProfiler) {
@@ -3587,9 +3591,7 @@ function flushPassiveEffectsImpl(wasDelayedCommit: void | boolean) {
3591
3592 if (enableProfilerTimer && enableComponentPerformanceTrack) {
3593 const passiveEffectsEndTime = now();
3590 - if (wasDelayedCommit) {
3591 - logPassiveCommitPhase(passiveEffectStartTime, passiveEffectsEndTime);
3592 - }
3594 + logPassiveCommitPhase(passiveEffectStartTime, passiveEffectsEndTime);
3595 finalizeRender(lanes, passiveEffectsEndTime);
3596 }
3597