@@ -1716,9 +1716,8 @@ function resetWorkInProgressStack() {
1716
1716
workInProgress = null ;
1717
1717
}
1718
1718
1719
- function finalizeRender ( lanes : Lanes ) : void {
1719
+ function finalizeRender ( lanes : Lanes , finalizationTime : number ) : void {
1720
1720
if ( enableProfilerTimer && enableComponentPerformanceTrack ) {
1721
- const finalizationTime = now ( ) ;
1722
1721
if ( includesBlockingLane ( lanes ) ) {
1723
1722
clampBlockingTimers ( finalizationTime ) ;
1724
1723
}
@@ -1733,6 +1732,11 @@ function prepareFreshStack(root: FiberRoot, lanes: Lanes): Fiber {
1733
1732
// Starting a new render. Log the end of any previous renders and the
1734
1733
// blocked time before the render started.
1735
1734
recordRenderTime ( ) ;
1735
+ // If this was a restart, e.g. due to an interrupting update, then there's no space
1736
+ // in the track to log the cause since we'll have rendered all the way up until the
1737
+ // restart so we need to clamp that.
1738
+ finalizeRender ( workInProgressRootRenderLanes , renderStartTime ) ;
1739
+
1736
1740
if ( includesBlockingLane ( lanes ) ) {
1737
1741
logBlockingStart (
1738
1742
blockingUpdateTime ,
@@ -3414,8 +3418,10 @@ function commitRootImpl(
3414
3418
nestedUpdateCount = 0 ;
3415
3419
}
3416
3420
3417
- if ( ! rootDidHavePassiveEffects ) {
3418
- finalizeRender ( lanes ) ;
3421
+ if ( enableProfilerTimer && enableComponentPerformanceTrack ) {
3422
+ if ( ! rootDidHavePassiveEffects ) {
3423
+ finalizeRender ( lanes , now ( ) ) ;
3424
+ }
3419
3425
}
3420
3426
3421
3427
// If layout work was scheduled, flush it now.
@@ -3599,7 +3605,9 @@ function flushPassiveEffectsImpl() {
3599
3605
3600
3606
executionContext = prevExecutionContext ;
3601
3607
3602
- finalizeRender ( lanes ) ;
3608
+ if ( enableProfilerTimer && enableComponentPerformanceTrack ) {
3609
+ finalizeRender ( lanes , now ( ) ) ;
3610
+ }
3603
3611
3604
3612
flushSyncWorkOnAllRoots ( ) ;
3605
3613
0 commit comments