(root, expirationTime, isAsync)
| 13136 | } |
| 13137 | |
| 13138 | function renderRoot(root, expirationTime, isAsync) { |
| 13139 | !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 13140 | isWorking = true; |
| 13141 | |
| 13142 | // Check if we're starting from a fresh stack, or if we're resuming from |
| 13143 | // previously yielded work. |
| 13144 | if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) { |
| 13145 | // Reset the stack and start working from the root. |
| 13146 | resetStack(); |
| 13147 | nextRoot = root; |
| 13148 | nextRenderExpirationTime = expirationTime; |
| 13149 | nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime); |
| 13150 | root.pendingCommitExpirationTime = NoWork; |
| 13151 | } |
| 13152 | |
| 13153 | var didFatal = false; |
| 13154 | |
| 13155 | startWorkLoopTimer(nextUnitOfWork); |
| 13156 | |
| 13157 | do { |
| 13158 | try { |
| 13159 | workLoop(isAsync); |
| 13160 | } catch (thrownValue) { |
| 13161 | if (nextUnitOfWork === null) { |
| 13162 | // This is a fatal error. |
| 13163 | didFatal = true; |
| 13164 | onUncaughtError(thrownValue); |
| 13165 | break; |
| 13166 | } |
| 13167 | |
| 13168 | if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) { |
| 13169 | var failedUnitOfWork = nextUnitOfWork; |
| 13170 | replayUnitOfWork(failedUnitOfWork, isAsync); |
| 13171 | } |
| 13172 | |
| 13173 | var sourceFiber = nextUnitOfWork; |
| 13174 | var returnFiber = sourceFiber['return']; |
| 13175 | if (returnFiber === null) { |
| 13176 | // This is a fatal error. |
| 13177 | didFatal = true; |
| 13178 | onUncaughtError(thrownValue); |
| 13179 | break; |
| 13180 | } |
| 13181 | throwException(returnFiber, sourceFiber, thrownValue); |
| 13182 | nextUnitOfWork = completeUnitOfWork(sourceFiber); |
| 13183 | } |
| 13184 | break; |
| 13185 | } while (true); |
| 13186 | |
| 13187 | // We're done performing work. Time to clean up. |
| 13188 | stopWorkLoopTimer(interruptedBy); |
| 13189 | interruptedBy = null; |
| 13190 | isWorking = false; |
| 13191 | |
| 13192 | // Yield back to main thread. |
| 13193 | if (didFatal) { |
| 13194 | // There was a fatal error. |
| 13195 | { |
no test coverage detected