(finishedWork)
| 12164 | } |
| 12165 | |
| 12166 | function commitRoot(finishedWork) { |
| 12167 | isWorking = true; |
| 12168 | isCommitting = true; |
| 12169 | startCommitTimer(); |
| 12170 | |
| 12171 | var root = finishedWork.stateNode; |
| 12172 | !(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; |
| 12173 | var committedExpirationTime = root.pendingCommitExpirationTime; |
| 12174 | !(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; |
| 12175 | root.pendingCommitExpirationTime = NoWork; |
| 12176 | |
| 12177 | var currentTime = recalculateCurrentTime(); |
| 12178 | |
| 12179 | // Reset this to null before calling lifecycles |
| 12180 | ReactCurrentOwner.current = null; |
| 12181 | |
| 12182 | var firstEffect = void 0; |
| 12183 | if (finishedWork.effectTag > PerformedWork) { |
| 12184 | // A fiber's effect list consists only of its children, not itself. So if |
| 12185 | // the root has an effect, we need to add it to the end of the list. The |
| 12186 | // resulting list is the set that would belong to the root's parent, if |
| 12187 | // it had one; that is, all the effects in the tree including the root. |
| 12188 | if (finishedWork.lastEffect !== null) { |
| 12189 | finishedWork.lastEffect.nextEffect = finishedWork; |
| 12190 | firstEffect = finishedWork.firstEffect; |
| 12191 | } else { |
| 12192 | firstEffect = finishedWork; |
| 12193 | } |
| 12194 | } else { |
| 12195 | // There is no effect on the root. |
| 12196 | firstEffect = finishedWork.firstEffect; |
| 12197 | } |
| 12198 | |
| 12199 | prepareForCommit(root.containerInfo); |
| 12200 | |
| 12201 | // Commit all the side-effects within a tree. We'll do this in two passes. |
| 12202 | // The first pass performs all the host insertions, updates, deletions and |
| 12203 | // ref unmounts. |
| 12204 | nextEffect = firstEffect; |
| 12205 | startCommitHostEffectsTimer(); |
| 12206 | while (nextEffect !== null) { |
| 12207 | var didError = false; |
| 12208 | var error = void 0; |
| 12209 | { |
| 12210 | invokeGuardedCallback$2(null, commitAllHostEffects, null); |
| 12211 | if (hasCaughtError()) { |
| 12212 | didError = true; |
| 12213 | error = clearCaughtError(); |
| 12214 | } |
| 12215 | } |
| 12216 | if (didError) { |
| 12217 | !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 12218 | onCommitPhaseError(nextEffect, error); |
| 12219 | // Clean-up |
| 12220 | if (nextEffect !== null) { |
| 12221 | nextEffect = nextEffect.nextEffect; |
| 12222 | } |
| 12223 | } |
no test coverage detected