(root, recoverableErrors, transitions, renderPriorityLevel)
| 26738 | } |
| 26739 | |
| 26740 | function commitRootImpl(root, recoverableErrors, transitions, renderPriorityLevel) { |
| 26741 | do { |
| 26742 | // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which |
| 26743 | // means `flushPassiveEffects` will sometimes result in additional |
| 26744 | // passive effects. So we need to keep flushing in a loop until there are |
| 26745 | // no more pending effects. |
| 26746 | // TODO: Might be better if `flushPassiveEffects` did not automatically |
| 26747 | // flush synchronous work at the end, to avoid factoring hazards like this. |
| 26748 | flushPassiveEffects(); |
| 26749 | } while (rootWithPendingPassiveEffects !== null); |
| 26750 | |
| 26751 | flushRenderPhaseStrictModeWarningsInDEV(); |
| 26752 | |
| 26753 | if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { |
| 26754 | throw new Error('Should not already be working.'); |
| 26755 | } |
| 26756 | |
| 26757 | var finishedWork = root.finishedWork; |
| 26758 | var lanes = root.finishedLanes; |
| 26759 | |
| 26760 | { |
| 26761 | markCommitStarted(lanes); |
| 26762 | } |
| 26763 | |
| 26764 | if (finishedWork === null) { |
| 26765 | |
| 26766 | { |
| 26767 | markCommitStopped(); |
| 26768 | } |
| 26769 | |
| 26770 | return null; |
| 26771 | } else { |
| 26772 | { |
| 26773 | if (lanes === NoLanes) { |
| 26774 | error('root.finishedLanes should not be empty during a commit. This is a ' + 'bug in React.'); |
| 26775 | } |
| 26776 | } |
| 26777 | } |
| 26778 | |
| 26779 | root.finishedWork = null; |
| 26780 | root.finishedLanes = NoLanes; |
| 26781 | |
| 26782 | if (finishedWork === root.current) { |
| 26783 | throw new Error('Cannot commit the same tree as before. This error is likely caused by ' + 'a bug in React. Please file an issue.'); |
| 26784 | } // commitRoot never returns a continuation; it always finishes synchronously. |
| 26785 | // So we can clear these now to allow a new callback to be scheduled. |
| 26786 | |
| 26787 | |
| 26788 | root.callbackNode = null; |
| 26789 | root.callbackPriority = NoLane; // Update the first and last pending times on this root. The new first |
| 26790 | // pending time is whatever is left on the root fiber. |
| 26791 | |
| 26792 | var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes); |
| 26793 | markRootFinished(root, remainingLanes); |
| 26794 | |
| 26795 | if (root === workInProgressRoot) { |
| 26796 | // We can reset these now that they are finished. |
| 26797 | workInProgressRoot = null; |
no test coverage detected
searching dependent graphs…