@@ -127,7 +127,6 @@ import {
127
127
captureCommitPhaseError ,
128
128
resolveRetryWakeable ,
129
129
markCommitTimeOfFallback ,
130
- enqueuePendingPassiveProfilerEffect ,
131
130
} from './ReactFiberWorkLoop.new' ;
132
131
import {
133
132
NoFlags as NoHookEffect ,
@@ -412,63 +411,6 @@ function commitHookEffectListMount(tag: number, finishedWork: Fiber) {
412
411
}
413
412
}
414
413
415
- export function commitPassiveEffectDurations (
416
- finishedRoot : FiberRoot ,
417
- finishedWork : Fiber ,
418
- ) : void {
419
- if ( enableProfilerTimer && enableProfilerCommitHooks ) {
420
- // Only Profilers with work in their subtree will have an Update effect scheduled.
421
- if ( ( finishedWork . flags & Update ) !== NoFlags ) {
422
- switch ( finishedWork . tag ) {
423
- case Profiler : {
424
- const { passiveEffectDuration } = finishedWork . stateNode ;
425
- const { id , onPostCommit } = finishedWork . memoizedProps ;
426
-
427
- // This value will still reflect the previous commit phase.
428
- // It does not get reset until the start of the next commit phase.
429
- const commitTime = getCommitTime ( ) ;
430
-
431
- let phase = finishedWork . alternate === null ? 'mount' : 'update' ;
432
- if ( enableProfilerNestedUpdatePhase ) {
433
- if ( isCurrentUpdateNested ( ) ) {
434
- phase = 'nested-update' ;
435
- }
436
- }
437
-
438
- if ( typeof onPostCommit === 'function' ) {
439
- if ( enableSchedulerTracing ) {
440
- onPostCommit (
441
- id ,
442
- phase ,
443
- passiveEffectDuration ,
444
- commitTime ,
445
- finishedRoot . memoizedInteractions ,
446
- ) ;
447
- } else {
448
- onPostCommit ( id , phase, passiveEffectDuration, commitTime) ;
449
- }
450
- }
451
-
452
- // Bubble times to the next nearest ancestor Profiler.
453
- // After we process that Profiler, we'll bubble further up.
454
- let parentFiber = finishedWork . return ;
455
- while ( parentFiber !== null ) {
456
- if ( parentFiber . tag === Profiler ) {
457
- const parentStateNode = parentFiber . stateNode ;
458
- parentStateNode . passiveEffectDuration += passiveEffectDuration ;
459
- break ;
460
- }
461
- parentFiber = parentFiber . return ;
462
- }
463
- break ;
464
- }
465
- default :
466
- break ;
467
- }
468
- }
469
- }
470
- }
471
-
472
414
function commitLifeCycles (
473
415
finishedRoot : FiberRoot ,
474
416
current : Fiber | null ,
@@ -750,11 +692,6 @@ function commitLifeCycles(
750
692
}
751
693
}
752
694
753
- // Schedule a passive effect for this Profiler to call onPostCommit hooks.
754
- // This effect should be scheduled even if there is no onPostCommit callback for this Profiler,
755
- // because the effect is also where times bubble to parent Profilers.
756
- enqueuePendingPassiveProfilerEffect ( finishedWork ) ;
757
-
758
695
// Propagate layout effect durations to the next nearest Profiler ancestor.
759
696
// Do not reset these values until the next render so DevTools has a chance to read them first.
760
697
let parentFiber = finishedWork . return ;
@@ -1889,6 +1826,53 @@ function commitPassiveMountOnFiber(
1889
1826
}
1890
1827
break ;
1891
1828
}
1829
+ case Profiler : {
1830
+ if ( enableProfilerTimer && enableProfilerCommitHooks ) {
1831
+ // Only Profilers with work in their subtree will have an Update effect scheduled.
1832
+ if ( ( finishedWork . flags & Update ) !== NoFlags ) {
1833
+ const { passiveEffectDuration } = finishedWork . stateNode ;
1834
+ const { id , onPostCommit } = finishedWork . memoizedProps ;
1835
+
1836
+ // This value will still reflect the previous commit phase.
1837
+ // It does not get reset until the start of the next commit phase.
1838
+ const commitTime = getCommitTime ( ) ;
1839
+
1840
+ let phase = finishedWork . alternate === null ? 'mount' : 'update' ;
1841
+ if ( enableProfilerNestedUpdatePhase ) {
1842
+ if ( isCurrentUpdateNested ( ) ) {
1843
+ phase = 'nested-update' ;
1844
+ }
1845
+ }
1846
+
1847
+ if ( typeof onPostCommit === 'function' ) {
1848
+ if ( enableSchedulerTracing ) {
1849
+ onPostCommit (
1850
+ id ,
1851
+ phase ,
1852
+ passiveEffectDuration ,
1853
+ commitTime ,
1854
+ finishedRoot . memoizedInteractions ,
1855
+ ) ;
1856
+ } else {
1857
+ onPostCommit ( id , phase, passiveEffectDuration, commitTime) ;
1858
+ }
1859
+ }
1860
+
1861
+ // Bubble times to the next nearest ancestor Profiler.
1862
+ // After we process that Profiler, we'll bubble further up.
1863
+ let parentFiber = finishedWork . return ;
1864
+ while ( parentFiber !== null ) {
1865
+ if ( parentFiber . tag === Profiler ) {
1866
+ const parentStateNode = parentFiber . stateNode ;
1867
+ parentStateNode . passiveEffectDuration += passiveEffectDuration ;
1868
+ break ;
1869
+ }
1870
+ parentFiber = parentFiber . return ;
1871
+ }
1872
+ }
1873
+ }
1874
+ break ;
1875
+ }
1892
1876
}
1893
1877
}
1894
1878
0 commit comments