(root, expirationTime, isAsync)
| 12624 | } |
| 12625 | |
| 12626 | function renderRoot(root, expirationTime, isAsync) { |
| 12627 | !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 12628 | isWorking = true; |
| 12629 | |
| 12630 | // Check if we're starting from a fresh stack, or if we're resuming from |
| 12631 | // previously yielded work. |
| 12632 | if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) { |
| 12633 | // Reset the stack and start working from the root. |
| 12634 | resetStack(); |
| 12635 | nextRoot = root; |
| 12636 | nextRenderExpirationTime = expirationTime; |
| 12637 | nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime); |
| 12638 | root.pendingCommitExpirationTime = NoWork; |
| 12639 | } |
| 12640 | |
| 12641 | var didFatal = false; |
| 12642 | |
| 12643 | startWorkLoopTimer(nextUnitOfWork); |
| 12644 | |
| 12645 | do { |
| 12646 | try { |
| 12647 | workLoop(isAsync); |
| 12648 | } catch (thrownValue) { |
| 12649 | if (nextUnitOfWork === null) { |
| 12650 | // This is a fatal error. |
| 12651 | didFatal = true; |
| 12652 | onUncaughtError(thrownValue); |
| 12653 | break; |
| 12654 | } |
| 12655 | |
| 12656 | if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { |
| 12657 | var failedUnitOfWork = nextUnitOfWork; |
| 12658 | replayUnitOfWork(failedUnitOfWork, isAsync); |
| 12659 | } |
| 12660 | |
| 12661 | var sourceFiber = nextUnitOfWork; |
| 12662 | var returnFiber = sourceFiber['return']; |
| 12663 | if (returnFiber === null) { |
| 12664 | // This is a fatal error. |
| 12665 | didFatal = true; |
| 12666 | onUncaughtError(thrownValue); |
| 12667 | break; |
| 12668 | } |
| 12669 | throwException(returnFiber, sourceFiber, thrownValue); |
| 12670 | nextUnitOfWork = completeUnitOfWork(sourceFiber); |
| 12671 | } |
| 12672 | break; |
| 12673 | } while (true); |
| 12674 | |
| 12675 | // We're done performing work. Time to clean up. |
| 12676 | stopWorkLoopTimer(interruptedBy); |
| 12677 | interruptedBy = null; |
| 12678 | isWorking = false; |
| 12679 | |
| 12680 | // Yield back to main thread. |
| 12681 | if (didFatal) { |
| 12682 | // There was a fatal error. |
| 12683 | { |
no test coverage detected