(finishedWork)
| 12292 | } |
| 12293 | |
| 12294 | function commitRoot(finishedWork) { |
| 12295 | isWorking = true; |
| 12296 | isCommitting = true; |
| 12297 | startCommitTimer(); |
| 12298 | |
| 12299 | var root = finishedWork.stateNode; |
| 12300 | !(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; |
| 12301 | var committedExpirationTime = root.pendingCommitExpirationTime; |
| 12302 | !(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; |
| 12303 | root.pendingCommitExpirationTime = NoWork; |
| 12304 | |
| 12305 | var currentTime = recalculateCurrentTime(); |
| 12306 | |
| 12307 | // Reset this to null before calling lifecycles |
| 12308 | ReactCurrentOwner.current = null; |
| 12309 | |
| 12310 | var firstEffect = void 0; |
| 12311 | if (finishedWork.effectTag > PerformedWork) { |
| 12312 | // A fiber's effect list consists only of its children, not itself. So if |
| 12313 | // the root has an effect, we need to add it to the end of the list. The |
| 12314 | // resulting list is the set that would belong to the root's parent, if |
| 12315 | // it had one; that is, all the effects in the tree including the root. |
| 12316 | if (finishedWork.lastEffect !== null) { |
| 12317 | finishedWork.lastEffect.nextEffect = finishedWork; |
| 12318 | firstEffect = finishedWork.firstEffect; |
| 12319 | } else { |
| 12320 | firstEffect = finishedWork; |
| 12321 | } |
| 12322 | } else { |
| 12323 | // There is no effect on the root. |
| 12324 | firstEffect = finishedWork.firstEffect; |
| 12325 | } |
| 12326 | |
| 12327 | prepareForCommit(root.containerInfo); |
| 12328 | |
| 12329 | // Commit all the side-effects within a tree. We'll do this in two passes. |
| 12330 | // The first pass performs all the host insertions, updates, deletions and |
| 12331 | // ref unmounts. |
| 12332 | nextEffect = firstEffect; |
| 12333 | startCommitHostEffectsTimer(); |
| 12334 | while (nextEffect !== null) { |
| 12335 | var didError = false; |
| 12336 | var error = void 0; |
| 12337 | { |
| 12338 | invokeGuardedCallback$2(null, commitAllHostEffects, null); |
| 12339 | if (hasCaughtError()) { |
| 12340 | didError = true; |
| 12341 | error = clearCaughtError(); |
| 12342 | } |
| 12343 | } |
| 12344 | if (didError) { |
| 12345 | !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 12346 | onCommitPhaseError(nextEffect, error); |
| 12347 | // Clean-up |
| 12348 | if (nextEffect !== null) { |
| 12349 | nextEffect = nextEffect.nextEffect; |
| 12350 | } |
| 12351 | } |
no test coverage detected