(root, expirationTime, isAsync)
| 13356 | } |
| 13357 | |
| 13358 | function renderRoot(root, expirationTime, isAsync) { |
| 13359 | !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 13360 | isWorking = true; |
| 13361 | |
| 13362 | // Check if we're starting from a fresh stack, or if we're resuming from |
| 13363 | // previously yielded work. |
| 13364 | if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) { |
| 13365 | // Reset the stack and start working from the root. |
| 13366 | resetStack(); |
| 13367 | nextRoot = root; |
| 13368 | nextRenderExpirationTime = expirationTime; |
| 13369 | nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime); |
| 13370 | root.pendingCommitExpirationTime = NoWork; |
| 13371 | } |
| 13372 | |
| 13373 | var didFatal = false; |
| 13374 | |
| 13375 | startWorkLoopTimer(nextUnitOfWork); |
| 13376 | |
| 13377 | do { |
| 13378 | try { |
| 13379 | workLoop(isAsync); |
| 13380 | } catch (thrownValue) { |
| 13381 | if (nextUnitOfWork === null) { |
| 13382 | // This is a fatal error. |
| 13383 | didFatal = true; |
| 13384 | onUncaughtError(thrownValue); |
| 13385 | break; |
| 13386 | } |
| 13387 | |
| 13388 | if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { |
| 13389 | var failedUnitOfWork = nextUnitOfWork; |
| 13390 | replayUnitOfWork(failedUnitOfWork, isAsync); |
| 13391 | } |
| 13392 | |
| 13393 | var sourceFiber = nextUnitOfWork; |
| 13394 | var returnFiber = sourceFiber['return']; |
| 13395 | if (returnFiber === null) { |
| 13396 | // This is a fatal error. |
| 13397 | didFatal = true; |
| 13398 | onUncaughtError(thrownValue); |
| 13399 | break; |
| 13400 | } |
| 13401 | throwException(returnFiber, sourceFiber, thrownValue); |
| 13402 | nextUnitOfWork = completeUnitOfWork(sourceFiber); |
| 13403 | } |
| 13404 | break; |
| 13405 | } while (true); |
| 13406 | |
| 13407 | // We're done performing work. Time to clean up. |
| 13408 | stopWorkLoopTimer(interruptedBy); |
| 13409 | interruptedBy = null; |
| 13410 | isWorking = false; |
| 13411 | |
| 13412 | // Yield back to main thread. |
| 13413 | if (didFatal) { |
| 13414 | // There was a fatal error. |
| 13415 | { |
no test coverage detected