(root, recoverableErrors, transitions, renderPriorityLevel)
| 26699 | } |
| 26700 | |
| 26701 | function commitRootImpl(root, recoverableErrors, transitions, renderPriorityLevel) { |
| 26702 | do { |
| 26703 | // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which |
| 26704 | // means `flushPassiveEffects` will sometimes result in additional |
| 26705 | // passive effects. So we need to keep flushing in a loop until there are |
| 26706 | // no more pending effects. |
| 26707 | // TODO: Might be better if `flushPassiveEffects` did not automatically |
| 26708 | // flush synchronous work at the end, to avoid factoring hazards like this. |
| 26709 | flushPassiveEffects(); |
| 26710 | } while (rootWithPendingPassiveEffects !== null); |
| 26711 | |
| 26712 | flushRenderPhaseStrictModeWarningsInDEV(); |
| 26713 | |
| 26714 | if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { |
| 26715 | throw new Error('Should not already be working.'); |
| 26716 | } |
| 26717 | |
| 26718 | var finishedWork = root.finishedWork; |
| 26719 | var lanes = root.finishedLanes; |
| 26720 | |
| 26721 | { |
| 26722 | markCommitStarted(lanes); |
| 26723 | } |
| 26724 | |
| 26725 | if (finishedWork === null) { |
| 26726 | |
| 26727 | { |
| 26728 | markCommitStopped(); |
| 26729 | } |
| 26730 | |
| 26731 | return null; |
| 26732 | } else { |
| 26733 | { |
| 26734 | if (lanes === NoLanes) { |
| 26735 | error('root.finishedLanes should not be empty during a commit. This is a ' + 'bug in React.'); |
| 26736 | } |
| 26737 | } |
| 26738 | } |
| 26739 | |
| 26740 | root.finishedWork = null; |
| 26741 | root.finishedLanes = NoLanes; |
| 26742 | |
| 26743 | if (finishedWork === root.current) { |
| 26744 | throw new Error('Cannot commit the same tree as before. This error is likely caused by ' + 'a bug in React. Please file an issue.'); |
| 26745 | } // commitRoot never returns a continuation; it always finishes synchronously. |
| 26746 | // So we can clear these now to allow a new callback to be scheduled. |
| 26747 | |
| 26748 | |
| 26749 | root.callbackNode = null; |
| 26750 | root.callbackPriority = NoLane; // Update the first and last pending times on this root. The new first |
| 26751 | // pending time is whatever is left on the root fiber. |
| 26752 | |
| 26753 | var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes); |
| 26754 | markRootFinished(root, remainingLanes); |
| 26755 | |
| 26756 | if (root === workInProgressRoot) { |
| 26757 | // We can reset these now that they are finished. |
| 26758 | workInProgressRoot = null; |
no test coverage detected
searching dependent graphs…