(finishedWork)
| 13024 | } |
| 13025 | |
| 13026 | function commitRoot(finishedWork) { |
| 13027 | isWorking = true; |
| 13028 | isCommitting = true; |
| 13029 | startCommitTimer(); |
| 13030 | |
| 13031 | var root = finishedWork.stateNode; |
| 13032 | !(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; |
| 13033 | var committedExpirationTime = root.pendingCommitExpirationTime; |
| 13034 | !(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; |
| 13035 | root.pendingCommitExpirationTime = NoWork; |
| 13036 | |
| 13037 | var currentTime = recalculateCurrentTime(); |
| 13038 | |
| 13039 | // Reset this to null before calling lifecycles |
| 13040 | ReactCurrentOwner.current = null; |
| 13041 | |
| 13042 | var firstEffect = void 0; |
| 13043 | if (finishedWork.effectTag > PerformedWork) { |
| 13044 | // A fiber's effect list consists only of its children, not itself. So if |
| 13045 | // the root has an effect, we need to add it to the end of the list. The |
| 13046 | // resulting list is the set that would belong to the root's parent, if |
| 13047 | // it had one; that is, all the effects in the tree including the root. |
| 13048 | if (finishedWork.lastEffect !== null) { |
| 13049 | finishedWork.lastEffect.nextEffect = finishedWork; |
| 13050 | firstEffect = finishedWork.firstEffect; |
| 13051 | } else { |
| 13052 | firstEffect = finishedWork; |
| 13053 | } |
| 13054 | } else { |
| 13055 | // There is no effect on the root. |
| 13056 | firstEffect = finishedWork.firstEffect; |
| 13057 | } |
| 13058 | |
| 13059 | prepareForCommit(root.containerInfo); |
| 13060 | |
| 13061 | // Commit all the side-effects within a tree. We'll do this in two passes. |
| 13062 | // The first pass performs all the host insertions, updates, deletions and |
| 13063 | // ref unmounts. |
| 13064 | nextEffect = firstEffect; |
| 13065 | startCommitHostEffectsTimer(); |
| 13066 | while (nextEffect !== null) { |
| 13067 | var didError = false; |
| 13068 | var error = void 0; |
| 13069 | { |
| 13070 | invokeGuardedCallback$2(null, commitAllHostEffects, null); |
| 13071 | if (hasCaughtError()) { |
| 13072 | didError = true; |
| 13073 | error = clearCaughtError(); |
| 13074 | } |
| 13075 | } |
| 13076 | if (didError) { |
| 13077 | !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 13078 | onCommitPhaseError(nextEffect, error); |
| 13079 | // Clean-up |
| 13080 | if (nextEffect !== null) { |
| 13081 | nextEffect = nextEffect.nextEffect; |
| 13082 | } |
| 13083 | } |
no test coverage detected