(root, expirationTime, isAsync)
| 13401 | } |
| 13402 | |
| 13403 | function renderRoot(root, expirationTime, isAsync) { |
| 13404 | !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 13405 | isWorking = true; |
| 13406 | |
| 13407 | // Check if we're starting from a fresh stack, or if we're resuming from |
| 13408 | // previously yielded work. |
| 13409 | if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) { |
| 13410 | // Reset the stack and start working from the root. |
| 13411 | resetStack(); |
| 13412 | nextRoot = root; |
| 13413 | nextRenderExpirationTime = expirationTime; |
| 13414 | nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime); |
| 13415 | root.pendingCommitExpirationTime = NoWork; |
| 13416 | } |
| 13417 | |
| 13418 | var didFatal = false; |
| 13419 | |
| 13420 | startWorkLoopTimer(nextUnitOfWork); |
| 13421 | |
| 13422 | do { |
| 13423 | try { |
| 13424 | workLoop(isAsync); |
| 13425 | } catch (thrownValue) { |
| 13426 | if (nextUnitOfWork === null) { |
| 13427 | // This is a fatal error. |
| 13428 | didFatal = true; |
| 13429 | onUncaughtError(thrownValue); |
| 13430 | break; |
| 13431 | } |
| 13432 | |
| 13433 | if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { |
| 13434 | var failedUnitOfWork = nextUnitOfWork; |
| 13435 | replayUnitOfWork(failedUnitOfWork, isAsync); |
| 13436 | } |
| 13437 | |
| 13438 | var sourceFiber = nextUnitOfWork; |
| 13439 | var returnFiber = sourceFiber['return']; |
| 13440 | if (returnFiber === null) { |
| 13441 | // This is a fatal error. |
| 13442 | didFatal = true; |
| 13443 | onUncaughtError(thrownValue); |
| 13444 | break; |
| 13445 | } |
| 13446 | throwException(returnFiber, sourceFiber, thrownValue); |
| 13447 | nextUnitOfWork = completeUnitOfWork(sourceFiber); |
| 13448 | } |
| 13449 | break; |
| 13450 | } while (true); |
| 13451 | |
| 13452 | // We're done performing work. Time to clean up. |
| 13453 | stopWorkLoopTimer(interruptedBy); |
| 13454 | interruptedBy = null; |
| 13455 | isWorking = false; |
| 13456 | |
| 13457 | // Yield back to main thread. |
| 13458 | if (didFatal) { |
| 13459 | // There was a fatal error. |
| 13460 | { |
no test coverage detected