(root, renderPriorityLevel)
| 22518 | } |
| 22519 | |
| 22520 | function commitRootImpl(root, renderPriorityLevel) { |
| 22521 | do { |
| 22522 | // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which |
| 22523 | // means `flushPassiveEffects` will sometimes result in additional |
| 22524 | // passive effects. So we need to keep flushing in a loop until there are |
| 22525 | // no more pending effects. |
| 22526 | // TODO: Might be better if `flushPassiveEffects` did not automatically |
| 22527 | // flush synchronous work at the end, to avoid factoring hazards like this. |
| 22528 | flushPassiveEffects(); |
| 22529 | } while (rootWithPendingPassiveEffects !== null); |
| 22530 | |
| 22531 | flushRenderPhaseStrictModeWarningsInDEV(); |
| 22532 | |
| 22533 | if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { |
| 22534 | { |
| 22535 | throw Error( "Should not already be working." ); |
| 22536 | } |
| 22537 | } |
| 22538 | |
| 22539 | var finishedWork = root.finishedWork; |
| 22540 | var expirationTime = root.finishedExpirationTime; |
| 22541 | |
| 22542 | if (finishedWork === null) { |
| 22543 | return null; |
| 22544 | } |
| 22545 | |
| 22546 | root.finishedWork = null; |
| 22547 | root.finishedExpirationTime = NoWork; |
| 22548 | |
| 22549 | if (!(finishedWork !== root.current)) { |
| 22550 | { |
| 22551 | throw Error( "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." ); |
| 22552 | } |
| 22553 | } // commitRoot never returns a continuation; it always finishes synchronously. |
| 22554 | // So we can clear these now to allow a new callback to be scheduled. |
| 22555 | |
| 22556 | |
| 22557 | root.callbackNode = null; |
| 22558 | root.callbackExpirationTime = NoWork; |
| 22559 | root.callbackPriority = NoPriority; |
| 22560 | root.nextKnownPendingLevel = NoWork; |
| 22561 | startCommitTimer(); // Update the first and last pending times on this root. The new first |
| 22562 | // pending time is whatever is left on the root fiber. |
| 22563 | |
| 22564 | var remainingExpirationTimeBeforeCommit = getRemainingExpirationTime(finishedWork); |
| 22565 | markRootFinishedAtTime(root, expirationTime, remainingExpirationTimeBeforeCommit); |
| 22566 | |
| 22567 | if (root === workInProgressRoot) { |
| 22568 | // We can reset these now that they are finished. |
| 22569 | workInProgressRoot = null; |
| 22570 | workInProgress = null; |
| 22571 | renderExpirationTime$1 = NoWork; |
| 22572 | } // This indicates that the last root we worked on is not the same one that |
| 22573 | // we're committing now. This most commonly happens when a suspended root |
| 22574 | // times out. |
| 22575 | // Get the list of effects. |
| 22576 | |
| 22577 |
nothing calls this directly
no test coverage detected
searching dependent graphs…