( root: FiberRoot, exitStatus: RootExitStatus, finishedWork: Fiber, lanes: Lanes, renderEndTime: number, // Profiling-only )
| 1340 | } |
| 1341 | |
| 1342 | function finishConcurrentRender( |
| 1343 | root: FiberRoot, |
| 1344 | exitStatus: RootExitStatus, |
| 1345 | finishedWork: Fiber, |
| 1346 | lanes: Lanes, |
| 1347 | renderEndTime: number, // Profiling-only |
| 1348 | ) { |
| 1349 | // TODO: The fact that most of these branches are identical suggests that some |
| 1350 | // of the exit statuses are not best modeled as exit statuses and should be |
| 1351 | // tracked orthogonally. |
| 1352 | switch (exitStatus) { |
| 1353 | case RootInProgress: |
| 1354 | case RootFatalErrored: { |
| 1355 | throw new Error('Root did not complete. This is a bug in React.'); |
| 1356 | } |
| 1357 | case RootSuspendedWithDelay: { |
| 1358 | if (!includesOnlyTransitions(lanes)) { |
| 1359 | // Commit the placeholder. |
| 1360 | break; |
| 1361 | } |
| 1362 | } |
| 1363 | // Fallthrough |
| 1364 | case RootSuspendedAtTheShell: { |
| 1365 | // This is a transition, so we should exit without committing a |
| 1366 | // placeholder and without scheduling a timeout. Delay indefinitely |
| 1367 | // until we receive more data. |
| 1368 | if (enableProfilerTimer && enableComponentPerformanceTrack) { |
| 1369 | setCurrentTrackFromLanes(lanes); |
| 1370 | logSuspendedRenderPhase( |
| 1371 | renderStartTime, |
| 1372 | renderEndTime, |
| 1373 | lanes, |
| 1374 | workInProgressUpdateTask, |
| 1375 | ); |
| 1376 | finalizeRender(lanes, renderEndTime); |
| 1377 | trackSuspendedTime(lanes, renderEndTime); |
| 1378 | } |
| 1379 | const didAttemptEntireTree = !workInProgressRootDidSkipSuspendedSiblings; |
| 1380 | markRootSuspended( |
| 1381 | root, |
| 1382 | lanes, |
| 1383 | workInProgressDeferredLane, |
| 1384 | didAttemptEntireTree, |
| 1385 | ); |
| 1386 | return; |
| 1387 | } |
| 1388 | case RootErrored: { |
| 1389 | // This render errored. Ignore any recoverable errors because we weren't actually |
| 1390 | // able to recover. Instead, whatever the final errors were is the ones we log. |
| 1391 | // This ensures that we only log the actual client side error if it's just a plain |
| 1392 | // error thrown from a component on the server and the client. |
| 1393 | workInProgressRootRecoverableErrors = null; |
| 1394 | break; |
| 1395 | } |
| 1396 | case RootSuspended: |
| 1397 | case RootCompleted: { |
| 1398 | break; |
| 1399 | } |
no test coverage detected