@@ -73,6 +73,7 @@ import {
7373 logSuspendedRenderPhase ,
7474 logErroredRenderPhase ,
7575 logInconsistentRender ,
76+ logSuspendedWithDelayPhase ,
7677 logSuspenseThrottlePhase ,
7778 logSuspendedCommitPhase ,
7879 logCommitPhase ,
@@ -239,12 +240,14 @@ import {
239240 blockingEventTime ,
240241 blockingEventType ,
241242 blockingEventIsRepeat ,
243+ blockingSuspendedTime ,
242244 transitionClampTime ,
243245 transitionStartTime ,
244246 transitionUpdateTime ,
245247 transitionEventTime ,
246248 transitionEventType ,
247249 transitionEventIsRepeat ,
250+ transitionSuspendedTime ,
248251 clearBlockingTimers ,
249252 clearTransitionTimers ,
250253 clampBlockingTimers ,
@@ -260,6 +263,7 @@ import {
260263 stopProfilerTimerIfRunningAndRecordDuration ,
261264 stopProfilerTimerIfRunningAndRecordIncompleteDuration ,
262265 markUpdateAsRepeat ,
266+ trackSuspendedTime ,
263267} from './ReactProfilerTimer' ;
264268import { setCurrentTrackFromLanes } from './ReactFiberPerformanceTrack' ;
265269
@@ -1144,7 +1148,7 @@ function finishConcurrentRender(
11441148 exitStatus : RootExitStatus ,
11451149 finishedWork : Fiber ,
11461150 lanes : Lanes ,
1147- renderEndTime : number // Profiling-only
1151+ renderEndTime : number , // Profiling-only
11481152) {
11491153 // TODO: The fact that most of these branches are identical suggests that some
11501154 // of the exit statuses are not best modeled as exit statuses and should be
@@ -1169,6 +1173,7 @@ function finishConcurrentRender(
11691173 setCurrentTrackFromLanes ( lanes ) ;
11701174 logSuspendedRenderPhase ( renderStartTime , renderEndTime ) ;
11711175 finalizeRender ( lanes , renderEndTime ) ;
1176+ trackSuspendedTime ( lanes , renderEndTime ) ;
11721177 }
11731178 const didAttemptEntireTree = ! workInProgressRootDidSkipSuspendedSiblings ;
11741179 markRootSuspended (
@@ -1704,30 +1709,64 @@ function prepareFreshStack(root: FiberRoot, lanes: Lanes): Fiber {
17041709 }
17051710
17061711 if ( includesSyncLane ( lanes ) || includesBlockingLane ( lanes ) ) {
1707- logBlockingStart (
1712+ const clampedUpdateTime =
17081713 blockingUpdateTime >= 0 && blockingUpdateTime < blockingClampTime
17091714 ? blockingClampTime
1710- : blockingUpdateTime ,
1715+ : blockingUpdateTime ;
1716+ const clampedEventTime =
17111717 blockingEventTime >= 0 && blockingEventTime < blockingClampTime
17121718 ? blockingClampTime
1713- : blockingEventTime ,
1719+ : blockingEventTime ;
1720+ if ( blockingSuspendedTime >= 0 ) {
1721+ setCurrentTrackFromLanes ( lanes ) ;
1722+ logSuspendedWithDelayPhase (
1723+ blockingSuspendedTime ,
1724+ // Clamp the suspended time to the first event/update.
1725+ clampedEventTime >= 0
1726+ ? clampedEventTime
1727+ : clampedUpdateTime >= 0
1728+ ? clampedUpdateTime
1729+ : renderStartTime ,
1730+ ) ;
1731+ }
1732+ logBlockingStart (
1733+ clampedUpdateTime ,
1734+ clampedEventTime ,
17141735 blockingEventType ,
17151736 blockingEventIsRepeat ,
17161737 renderStartTime ,
17171738 ) ;
17181739 clearBlockingTimers ( ) ;
17191740 }
17201741 if ( includesTransitionLane ( lanes ) ) {
1721- logTransitionStart (
1742+ const clampedStartTime =
17221743 transitionStartTime >= 0 && transitionStartTime < transitionClampTime
17231744 ? transitionClampTime
1724- : transitionStartTime ,
1745+ : transitionStartTime ;
1746+ const clampedUpdateTime =
17251747 transitionUpdateTime >= 0 && transitionUpdateTime < transitionClampTime
17261748 ? transitionClampTime
1727- : transitionUpdateTime ,
1749+ : transitionUpdateTime ;
1750+ const clampedEventTime =
17281751 transitionEventTime >= 0 && transitionEventTime < transitionClampTime
17291752 ? transitionClampTime
1730- : transitionEventTime ,
1753+ : transitionEventTime ;
1754+ if ( transitionSuspendedTime >= 0 ) {
1755+ setCurrentTrackFromLanes ( lanes ) ;
1756+ logSuspendedWithDelayPhase (
1757+ transitionSuspendedTime ,
1758+ // Clamp the suspended time to the first event/update.
1759+ clampedEventTime >= 0
1760+ ? clampedEventTime
1761+ : clampedUpdateTime >= 0
1762+ ? clampedUpdateTime
1763+ : renderStartTime ,
1764+ ) ;
1765+ }
1766+ logTransitionStart (
1767+ clampedStartTime ,
1768+ clampedUpdateTime ,
1769+ clampedEventTime ,
17311770 transitionEventType ,
17321771 transitionEventIsRepeat ,
17331772 renderStartTime ,
0 commit comments