@@ -121,7 +121,6 @@ import {
121121  captureCommitPhaseError , 
122122  resolveRetryWakeable , 
123123  markCommitTimeOfFallback , 
124-   enqueuePendingPassiveProfilerEffect , 
125124  schedulePassiveEffectCallback , 
126125}  from  './ReactFiberWorkLoop.new' ; 
127126import  { 
@@ -507,57 +506,55 @@ function commitHookEffectListMount2(fiber: Fiber): void {
507506  } 
508507} 
509508
510- export   function  commitPassiveEffectDurations ( 
509+ function  commitProfilerPassiveEffect ( 
511510  finishedRoot : FiberRoot , 
512511  finishedWork : Fiber , 
513512) : void  { 
514513  if  ( enableProfilerTimer  &&  enableProfilerCommitHooks )  { 
515-     // Only Profilers with work in their subtree will have an Update effect scheduled. 
516-     if  ( ( finishedWork . flags  &  Update )  !==  NoFlags )  { 
517-       switch  ( finishedWork . tag )  { 
518-         case  Profiler : { 
519-           const  { passiveEffectDuration }  =  finishedWork . stateNode ; 
520-           const  { id ,  onPostCommit }  =  finishedWork . memoizedProps ; 
521- 
522-           // This value will still reflect the previous commit phase. 
523-           // It does not get reset until the start of the next commit phase. 
524-           const  commitTime  =  getCommitTime ( ) ; 
525- 
526-           if  ( typeof  onPostCommit  ===  'function' )  { 
527-             if  ( enableSchedulerTracing )  { 
528-               onPostCommit ( 
529-                 id , 
530-                 finishedWork . alternate  ===  null  ? 'mount'  : 'update' , 
531-                 passiveEffectDuration , 
532-                 commitTime , 
533-                 finishedRoot . memoizedInteractions , 
534-               ) ; 
535-             }  else  { 
536-               onPostCommit ( 
537-                 id , 
538-                 finishedWork. alternate  ===  null  ? 'mount'  : 'update' , 
539-                 passiveEffectDuration , 
540-                 commitTime , 
541-               ) ; 
542-             } 
514+     switch  ( finishedWork . tag )  { 
515+       case  Profiler : { 
516+         const  { passiveEffectDuration }  =  finishedWork . stateNode ; 
517+         const  { id ,  onPostCommit }  =  finishedWork . memoizedProps ; 
518+ 
519+         // This value will still reflect the previous commit phase. 
520+         // It does not get reset until the start of the next commit phase. 
521+         const  commitTime  =  getCommitTime ( ) ; 
522+ 
523+         if  ( typeof  onPostCommit  ===  'function' )  { 
524+           if  ( enableSchedulerTracing )  { 
525+             onPostCommit ( 
526+               id , 
527+               finishedWork . alternate  ===  null  ? 'mount'  : 'update' , 
528+               passiveEffectDuration , 
529+               commitTime , 
530+               finishedRoot . memoizedInteractions , 
531+             ) ; 
532+           }  else  { 
533+             onPostCommit ( 
534+               id , 
535+               finishedWork. alternate  ===  null  ? 'mount'  : 'update' , 
536+               passiveEffectDuration , 
537+               commitTime , 
538+             ) ; 
543539          } 
540+         } 
544541
545-           // Bubble times to the next nearest ancestor Profiler. 
546-           // After we process that Profiler, we'll bubble further up. 
547-           let  parentFiber  =  finishedWork . return ; 
548-           while  ( parentFiber  !==  null )  { 
549-             if  ( parentFiber . tag  ===  Profiler )  { 
550-               const  parentStateNode  =  parentFiber . stateNode ; 
551-               parentStateNode . passiveEffectDuration  +=  passiveEffectDuration ; 
552-               break ; 
553-             } 
554-             parentFiber  =  parentFiber . return ; 
542+         // Bubble times to the next nearest ancestor Profiler. 
543+         // After we process that Profiler, we'll bubble further up. 
544+         // TODO: Use JS Stack instead 
545+         let  parentFiber  =  finishedWork . return ; 
546+         while  ( parentFiber  !==  null )  { 
547+           if  ( parentFiber . tag  ===  Profiler )  { 
548+             const  parentStateNode  =  parentFiber . stateNode ; 
549+             parentStateNode . passiveEffectDuration  +=  passiveEffectDuration ; 
550+             break ; 
555551          } 
556-           break ; 
552+           parentFiber   =   parentFiber . return ; 
557553        } 
558-         default :
559-           break ; 
554+         break ; 
560555      } 
556+       default :
557+         break ; 
561558    } 
562559  } 
563560} 
@@ -841,13 +838,9 @@ function commitLifeCycles(
841838            } 
842839          } 
843840
844-           // Schedule a passive effect for this Profiler to call onPostCommit hooks. 
845-           // This effect should be scheduled even if there is no onPostCommit callback for this Profiler, 
846-           // because the effect is also where times bubble to parent Profilers. 
847-           enqueuePendingPassiveProfilerEffect ( finishedWork ) ; 
848- 
849841          // Propagate layout effect durations to the next nearest Profiler ancestor. 
850842          // Do not reset these values until the next render so DevTools has a chance to read them first. 
843+           // TODO: Use JS Stack instead 
851844          let  parentFiber  =  finishedWork . return ; 
852845          while  ( parentFiber  !==  null )  { 
853846            if  ( parentFiber . tag  ===  Profiler )  { 
@@ -1912,6 +1905,7 @@ function commitPassiveWork(finishedWork: Fiber): void {
19121905        finishedWork , 
19131906        finishedWork . return , 
19141907      ) ; 
1908+       break ; 
19151909    } 
19161910  } 
19171911} 
@@ -1933,13 +1927,21 @@ function commitPassiveUnmount(
19331927  } 
19341928} 
19351929
1936- function  commitPassiveLifeCycles ( finishedWork : Fiber ) : void  { 
1930+ function  commitPassiveLifeCycles ( 
1931+   finishedRoot : FiberRoot , 
1932+   finishedWork : Fiber , 
1933+ ) : void  { 
19371934  switch  ( finishedWork . tag )  { 
19381935    case  FunctionComponent :
19391936    case  ForwardRef :
19401937    case  SimpleMemoComponent :
19411938    case  Block : { 
19421939      commitHookEffectListMount2 ( finishedWork ) ; 
1940+       break ; 
1941+     } 
1942+     case  Profiler : { 
1943+       commitProfilerPassiveEffect ( finishedRoot ,  finishedWork ) ; 
1944+       break ; 
19431945    } 
19441946  } 
19451947} 
0 commit comments