(root, expirationTime, isAsync)
| 12496 | } |
| 12497 | |
| 12498 | function renderRoot(root, expirationTime, isAsync) { |
| 12499 | !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 12500 | isWorking = true; |
| 12501 | |
| 12502 | // Check if we're starting from a fresh stack, or if we're resuming from |
| 12503 | // previously yielded work. |
| 12504 | if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) { |
| 12505 | // Reset the stack and start working from the root. |
| 12506 | resetStack(); |
| 12507 | nextRoot = root; |
| 12508 | nextRenderExpirationTime = expirationTime; |
| 12509 | nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime); |
| 12510 | root.pendingCommitExpirationTime = NoWork; |
| 12511 | } |
| 12512 | |
| 12513 | var didFatal = false; |
| 12514 | |
| 12515 | startWorkLoopTimer(nextUnitOfWork); |
| 12516 | |
| 12517 | do { |
| 12518 | try { |
| 12519 | workLoop(isAsync); |
| 12520 | } catch (thrownValue) { |
| 12521 | if (nextUnitOfWork === null) { |
| 12522 | // This is a fatal error. |
| 12523 | didFatal = true; |
| 12524 | onUncaughtError(thrownValue); |
| 12525 | break; |
| 12526 | } |
| 12527 | |
| 12528 | if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { |
| 12529 | var failedUnitOfWork = nextUnitOfWork; |
| 12530 | replayUnitOfWork(failedUnitOfWork, isAsync); |
| 12531 | } |
| 12532 | |
| 12533 | var sourceFiber = nextUnitOfWork; |
| 12534 | var returnFiber = sourceFiber['return']; |
| 12535 | if (returnFiber === null) { |
| 12536 | // This is a fatal error. |
| 12537 | didFatal = true; |
| 12538 | onUncaughtError(thrownValue); |
| 12539 | break; |
| 12540 | } |
| 12541 | throwException(returnFiber, sourceFiber, thrownValue); |
| 12542 | nextUnitOfWork = completeUnitOfWork(sourceFiber); |
| 12543 | } |
| 12544 | break; |
| 12545 | } while (true); |
| 12546 | |
| 12547 | // We're done performing work. Time to clean up. |
| 12548 | stopWorkLoopTimer(interruptedBy); |
| 12549 | interruptedBy = null; |
| 12550 | isWorking = false; |
| 12551 | |
| 12552 | // Yield back to main thread. |
| 12553 | if (didFatal) { |
| 12554 | // There was a fatal error. |
| 12555 | { |
no test coverage detected