(finishedWork)
| 12255 | } |
| 12256 | |
| 12257 | function commitRoot(finishedWork) { |
| 12258 | isWorking = true; |
| 12259 | isCommitting = true; |
| 12260 | startCommitTimer(); |
| 12261 | |
| 12262 | var root = finishedWork.stateNode; |
| 12263 | !(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; |
| 12264 | var committedExpirationTime = root.pendingCommitExpirationTime; |
| 12265 | !(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; |
| 12266 | root.pendingCommitExpirationTime = NoWork; |
| 12267 | |
| 12268 | var currentTime = recalculateCurrentTime(); |
| 12269 | |
| 12270 | // Reset this to null before calling lifecycles |
| 12271 | ReactCurrentOwner.current = null; |
| 12272 | |
| 12273 | var firstEffect = void 0; |
| 12274 | if (finishedWork.effectTag > PerformedWork) { |
| 12275 | // A fiber's effect list consists only of its children, not itself. So if |
| 12276 | // the root has an effect, we need to add it to the end of the list. The |
| 12277 | // resulting list is the set that would belong to the root's parent, if |
| 12278 | // it had one; that is, all the effects in the tree including the root. |
| 12279 | if (finishedWork.lastEffect !== null) { |
| 12280 | finishedWork.lastEffect.nextEffect = finishedWork; |
| 12281 | firstEffect = finishedWork.firstEffect; |
| 12282 | } else { |
| 12283 | firstEffect = finishedWork; |
| 12284 | } |
| 12285 | } else { |
| 12286 | // There is no effect on the root. |
| 12287 | firstEffect = finishedWork.firstEffect; |
| 12288 | } |
| 12289 | |
| 12290 | prepareForCommit(root.containerInfo); |
| 12291 | |
| 12292 | // Commit all the side-effects within a tree. We'll do this in two passes. |
| 12293 | // The first pass performs all the host insertions, updates, deletions and |
| 12294 | // ref unmounts. |
| 12295 | nextEffect = firstEffect; |
| 12296 | startCommitHostEffectsTimer(); |
| 12297 | while (nextEffect !== null) { |
| 12298 | var didError = false; |
| 12299 | var error = void 0; |
| 12300 | { |
| 12301 | invokeGuardedCallback$2(null, commitAllHostEffects, null); |
| 12302 | if (hasCaughtError()) { |
| 12303 | didError = true; |
| 12304 | error = clearCaughtError(); |
| 12305 | } |
| 12306 | } |
| 12307 | if (didError) { |
| 12308 | !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 12309 | onCommitPhaseError(nextEffect, error); |
| 12310 | // Clean-up |
| 12311 | if (nextEffect !== null) { |
| 12312 | nextEffect = nextEffect.nextEffect; |
| 12313 | } |
| 12314 | } |
no test coverage detected