()
| 3978 | } |
| 3979 | |
| 3980 | function flushSpawnedWork(): void { |
| 3981 | if ( |
| 3982 | pendingEffectsStatus !== PENDING_SPAWNED_WORK && |
| 3983 | // If a startViewTransition times out, we might flush this earlier than |
| 3984 | // after mutation phase. In that case, we just skip the after mutation phase. |
| 3985 | pendingEffectsStatus !== PENDING_AFTER_MUTATION_PHASE |
| 3986 | ) { |
| 3987 | return; |
| 3988 | } |
| 3989 | if (enableProfilerTimer && enableComponentPerformanceTrack) { |
| 3990 | // If we didn't skip the after mutation phase, when is means we started an animation. |
| 3991 | const startedAnimation = pendingEffectsStatus === PENDING_SPAWNED_WORK; |
| 3992 | if (startedAnimation) { |
| 3993 | const startViewTransitionStartTime = commitEndTime; |
| 3994 | // Update the new commitEndTime to when we started the animation. |
| 3995 | recordCommitEndTime(); |
| 3996 | logStartViewTransitionYieldPhase( |
| 3997 | startViewTransitionStartTime, |
| 3998 | commitEndTime, |
| 3999 | pendingDelayedCommitReason === ABORTED_VIEW_TRANSITION_COMMIT, |
| 4000 | animatingTask, |
| 4001 | ); |
| 4002 | if (pendingDelayedCommitReason !== ABORTED_VIEW_TRANSITION_COMMIT) { |
| 4003 | pendingDelayedCommitReason = ANIMATION_STARTED_COMMIT; |
| 4004 | } |
| 4005 | } |
| 4006 | } |
| 4007 | |
| 4008 | pendingEffectsStatus = NO_PENDING_EFFECTS; |
| 4009 | |
| 4010 | pendingViewTransition = null; // The view transition has now fully started. |
| 4011 | |
| 4012 | // Tell Scheduler to yield at the end of the frame, so the browser has an |
| 4013 | // opportunity to paint. |
| 4014 | requestPaint(); |
| 4015 | |
| 4016 | const root = pendingEffectsRoot; |
| 4017 | const finishedWork = pendingFinishedWork; |
| 4018 | const lanes = pendingEffectsLanes; |
| 4019 | const recoverableErrors = pendingRecoverableErrors; |
| 4020 | const didIncludeRenderPhaseUpdate = pendingDidIncludeRenderPhaseUpdate; |
| 4021 | |
| 4022 | const passiveSubtreeMask = |
| 4023 | enableViewTransition && includesOnlyViewTransitionEligibleLanes(lanes) |
| 4024 | ? PassiveTransitionMask |
| 4025 | : PassiveMask; |
| 4026 | const rootDidHavePassiveEffects = // If this subtree rendered with profiling this commit, we need to visit it to log it. |
| 4027 | (enableProfilerTimer && |
| 4028 | enableComponentPerformanceTrack && |
| 4029 | finishedWork.actualDuration !== 0) || |
| 4030 | (finishedWork.subtreeFlags & passiveSubtreeMask) !== NoFlags || |
| 4031 | (finishedWork.flags & passiveSubtreeMask) !== NoFlags; |
| 4032 | |
| 4033 | if (rootDidHavePassiveEffects) { |
| 4034 | pendingEffectsStatus = PENDING_PASSIVE_PHASE; |
| 4035 | } else { |
| 4036 | pendingEffectsStatus = NO_PENDING_EFFECTS; |
| 4037 | pendingEffectsRoot = (null: any); // Clear for GC purposes. |
no test coverage detected