(root, expirationTime, isAsync)
| 12587 | } |
| 12588 | |
| 12589 | function renderRoot(root, expirationTime, isAsync) { |
| 12590 | !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 12591 | isWorking = true; |
| 12592 | |
| 12593 | // Check if we're starting from a fresh stack, or if we're resuming from |
| 12594 | // previously yielded work. |
| 12595 | if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) { |
| 12596 | // Reset the stack and start working from the root. |
| 12597 | resetStack(); |
| 12598 | nextRoot = root; |
| 12599 | nextRenderExpirationTime = expirationTime; |
| 12600 | nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime); |
| 12601 | root.pendingCommitExpirationTime = NoWork; |
| 12602 | } |
| 12603 | |
| 12604 | var didFatal = false; |
| 12605 | |
| 12606 | startWorkLoopTimer(nextUnitOfWork); |
| 12607 | |
| 12608 | do { |
| 12609 | try { |
| 12610 | workLoop(isAsync); |
| 12611 | } catch (thrownValue) { |
| 12612 | if (nextUnitOfWork === null) { |
| 12613 | // This is a fatal error. |
| 12614 | didFatal = true; |
| 12615 | onUncaughtError(thrownValue); |
| 12616 | break; |
| 12617 | } |
| 12618 | |
| 12619 | if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { |
| 12620 | var failedUnitOfWork = nextUnitOfWork; |
| 12621 | replayUnitOfWork(failedUnitOfWork, isAsync); |
| 12622 | } |
| 12623 | |
| 12624 | var sourceFiber = nextUnitOfWork; |
| 12625 | var returnFiber = sourceFiber['return']; |
| 12626 | if (returnFiber === null) { |
| 12627 | // This is a fatal error. |
| 12628 | didFatal = true; |
| 12629 | onUncaughtError(thrownValue); |
| 12630 | break; |
| 12631 | } |
| 12632 | throwException(returnFiber, sourceFiber, thrownValue); |
| 12633 | nextUnitOfWork = completeUnitOfWork(sourceFiber); |
| 12634 | } |
| 12635 | break; |
| 12636 | } while (true); |
| 12637 | |
| 12638 | // We're done performing work. Time to clean up. |
| 12639 | stopWorkLoopTimer(interruptedBy); |
| 12640 | interruptedBy = null; |
| 12641 | isWorking = false; |
| 12642 | |
| 12643 | // Yield back to main thread. |
| 12644 | if (didFatal) { |
| 12645 | // There was a fatal error. |
| 12646 | { |
no test coverage detected