()
| 3833 | } |
| 3834 | |
| 3835 | function flushMutationEffects(): void { |
| 3836 | if (pendingEffectsStatus !== PENDING_MUTATION_PHASE) { |
| 3837 | return; |
| 3838 | } |
| 3839 | pendingEffectsStatus = NO_PENDING_EFFECTS; |
| 3840 | |
| 3841 | const root = pendingEffectsRoot; |
| 3842 | const finishedWork = pendingFinishedWork; |
| 3843 | const lanes = pendingEffectsLanes; |
| 3844 | const subtreeMutationHasEffects = |
| 3845 | (finishedWork.subtreeFlags & MutationMask) !== NoFlags; |
| 3846 | const rootMutationHasEffect = (finishedWork.flags & MutationMask) !== NoFlags; |
| 3847 | |
| 3848 | if (subtreeMutationHasEffects || rootMutationHasEffect) { |
| 3849 | const prevTransition = ReactSharedInternals.T; |
| 3850 | ReactSharedInternals.T = null; |
| 3851 | const previousPriority = getCurrentUpdatePriority(); |
| 3852 | setCurrentUpdatePriority(DiscreteEventPriority); |
| 3853 | const prevExecutionContext = executionContext; |
| 3854 | executionContext |= CommitContext; |
| 3855 | try { |
| 3856 | // The next phase is the mutation phase, where we mutate the host tree. |
| 3857 | commitMutationEffects(root, finishedWork, lanes); |
| 3858 | |
| 3859 | if (enableCreateEventHandleAPI) { |
| 3860 | if (shouldFireAfterActiveInstanceBlur) { |
| 3861 | afterActiveInstanceBlur(); |
| 3862 | } |
| 3863 | } |
| 3864 | resetAfterCommit(root.containerInfo); |
| 3865 | } finally { |
| 3866 | // Reset the priority to the previous non-sync value. |
| 3867 | executionContext = prevExecutionContext; |
| 3868 | setCurrentUpdatePriority(previousPriority); |
| 3869 | ReactSharedInternals.T = prevTransition; |
| 3870 | } |
| 3871 | } |
| 3872 | |
| 3873 | // The work-in-progress tree is now the current tree. This must come after |
| 3874 | // the mutation phase, so that the previous tree is still current during |
| 3875 | // componentWillUnmount, but before the layout phase, so that the finished |
| 3876 | // work is current during componentDidMount/Update. |
| 3877 | root.current = finishedWork; |
| 3878 | pendingEffectsStatus = PENDING_LAYOUT_PHASE; |
| 3879 | } |
| 3880 | |
| 3881 | function flushLayoutEffects(): void { |
| 3882 | if (pendingEffectsStatus !== PENDING_LAYOUT_PHASE) { |
no test coverage detected