(finishedWork)
| 12966 | } |
| 12967 | |
| 12968 | function commitRoot(finishedWork) { |
| 12969 | isWorking = true; |
| 12970 | isCommitting = true; |
| 12971 | startCommitTimer(); |
| 12972 | |
| 12973 | var root = finishedWork.stateNode; |
| 12974 | !(root.current !== finishedWork) ? invariant(false, 'Cannot commit the same tree as before. This is probably a bug related to the return field. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 12975 | var committedExpirationTime = root.pendingCommitExpirationTime; |
| 12976 | !(committedExpirationTime !== NoWork) ? invariant(false, 'Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 12977 | root.pendingCommitExpirationTime = NoWork; |
| 12978 | |
| 12979 | var currentTime = recalculateCurrentTime(); |
| 12980 | |
| 12981 | // Reset this to null before calling lifecycles |
| 12982 | ReactCurrentOwner.current = null; |
| 12983 | |
| 12984 | var firstEffect = void 0; |
| 12985 | if (finishedWork.effectTag > PerformedWork) { |
| 12986 | // A fiber's effect list consists only of its children, not itself. So if |
| 12987 | // the root has an effect, we need to add it to the end of the list. The |
| 12988 | // resulting list is the set that would belong to the root's parent, if |
| 12989 | // it had one; that is, all the effects in the tree including the root. |
| 12990 | if (finishedWork.lastEffect !== null) { |
| 12991 | finishedWork.lastEffect.nextEffect = finishedWork; |
| 12992 | firstEffect = finishedWork.firstEffect; |
| 12993 | } else { |
| 12994 | firstEffect = finishedWork; |
| 12995 | } |
| 12996 | } else { |
| 12997 | // There is no effect on the root. |
| 12998 | firstEffect = finishedWork.firstEffect; |
| 12999 | } |
| 13000 | |
| 13001 | prepareForCommit(root.containerInfo); |
| 13002 | |
| 13003 | // Commit all the side-effects within a tree. We'll do this in two passes. |
| 13004 | // The first pass performs all the host insertions, updates, deletions and |
| 13005 | // ref unmounts. |
| 13006 | nextEffect = firstEffect; |
| 13007 | startCommitHostEffectsTimer(); |
| 13008 | while (nextEffect !== null) { |
| 13009 | var didError = false; |
| 13010 | var error = void 0; |
| 13011 | { |
| 13012 | invokeGuardedCallback$2(null, commitAllHostEffects, null); |
| 13013 | if (hasCaughtError()) { |
| 13014 | didError = true; |
| 13015 | error = clearCaughtError(); |
| 13016 | } |
| 13017 | } |
| 13018 | if (didError) { |
| 13019 | !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 13020 | onCommitPhaseError(nextEffect, error); |
| 13021 | // Clean-up |
| 13022 | if (nextEffect !== null) { |
| 13023 | nextEffect = nextEffect.nextEffect; |
| 13024 | } |
| 13025 | } |
no test coverage detected