(root, expirationTime, isAsync)
| 13514 | } |
| 13515 | |
| 13516 | function renderRoot(root, expirationTime, isAsync) { |
| 13517 | !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 13518 | isWorking = true; |
| 13519 | |
| 13520 | // Check if we're starting from a fresh stack, or if we're resuming from |
| 13521 | // previously yielded work. |
| 13522 | if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) { |
| 13523 | // Reset the stack and start working from the root. |
| 13524 | resetStack(); |
| 13525 | nextRoot = root; |
| 13526 | nextRenderExpirationTime = expirationTime; |
| 13527 | nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime); |
| 13528 | root.pendingCommitExpirationTime = NoWork; |
| 13529 | } |
| 13530 | |
| 13531 | var didFatal = false; |
| 13532 | |
| 13533 | startWorkLoopTimer(nextUnitOfWork); |
| 13534 | |
| 13535 | do { |
| 13536 | try { |
| 13537 | workLoop(isAsync); |
| 13538 | } catch (thrownValue) { |
| 13539 | if (nextUnitOfWork === null) { |
| 13540 | // This is a fatal error. |
| 13541 | didFatal = true; |
| 13542 | onUncaughtError(thrownValue); |
| 13543 | break; |
| 13544 | } |
| 13545 | |
| 13546 | if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { |
| 13547 | var failedUnitOfWork = nextUnitOfWork; |
| 13548 | replayUnitOfWork(failedUnitOfWork, isAsync); |
| 13549 | } |
| 13550 | |
| 13551 | var sourceFiber = nextUnitOfWork; |
| 13552 | var returnFiber = sourceFiber['return']; |
| 13553 | if (returnFiber === null) { |
| 13554 | // This is a fatal error. |
| 13555 | didFatal = true; |
| 13556 | onUncaughtError(thrownValue); |
| 13557 | break; |
| 13558 | } |
| 13559 | throwException(returnFiber, sourceFiber, thrownValue); |
| 13560 | nextUnitOfWork = completeUnitOfWork(sourceFiber); |
| 13561 | } |
| 13562 | break; |
| 13563 | } while (true); |
| 13564 | |
| 13565 | // We're done performing work. Time to clean up. |
| 13566 | stopWorkLoopTimer(interruptedBy); |
| 13567 | interruptedBy = null; |
| 13568 | isWorking = false; |
| 13569 | |
| 13570 | // Yield back to main thread. |
| 13571 | if (didFatal) { |
| 13572 | // There was a fatal error. |
| 13573 | { |
no test coverage detected