(root, finishedWork, exitStatus, expirationTime)
| 21636 | } |
| 21637 | |
| 21638 | function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime) { |
| 21639 | // Set this to null to indicate there's no in-progress render. |
| 21640 | workInProgressRoot = null; |
| 21641 | |
| 21642 | switch (exitStatus) { |
| 21643 | case RootIncomplete: |
| 21644 | case RootFatalErrored: |
| 21645 | { |
| 21646 | { |
| 21647 | { |
| 21648 | throw Error( "Root did not complete. This is a bug in React." ); |
| 21649 | } |
| 21650 | } |
| 21651 | } |
| 21652 | // Flow knows about invariant, so it complains if I add a break |
| 21653 | // statement, but eslint doesn't know about invariant, so it complains |
| 21654 | // if I do. eslint-disable-next-line no-fallthrough |
| 21655 | |
| 21656 | case RootErrored: |
| 21657 | { |
| 21658 | // If this was an async render, the error may have happened due to |
| 21659 | // a mutation in a concurrent event. Try rendering one more time, |
| 21660 | // synchronously, to see if the error goes away. If there are |
| 21661 | // lower priority updates, let's include those, too, in case they |
| 21662 | // fix the inconsistency. Render at Idle to include all updates. |
| 21663 | // If it was Idle or Never or some not-yet-invented time, render |
| 21664 | // at that time. |
| 21665 | markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous |
| 21666 | // and therefore not hit this path again. |
| 21667 | |
| 21668 | break; |
| 21669 | } |
| 21670 | |
| 21671 | case RootSuspended: |
| 21672 | { |
| 21673 | markRootSuspendedAtTime(root, expirationTime); |
| 21674 | var lastSuspendedTime = root.lastSuspendedTime; |
| 21675 | |
| 21676 | if (expirationTime === lastSuspendedTime) { |
| 21677 | root.nextKnownPendingLevel = getRemainingExpirationTime(finishedWork); |
| 21678 | } // We have an acceptable loading state. We need to figure out if we |
| 21679 | // should immediately commit it or wait a bit. |
| 21680 | // If we have processed new updates during this render, we may now |
| 21681 | // have a new loading state ready. We want to ensure that we commit |
| 21682 | // that as soon as possible. |
| 21683 | |
| 21684 | |
| 21685 | var hasNotProcessedNewUpdates = workInProgressRootLatestProcessedExpirationTime === Sync; |
| 21686 | |
| 21687 | if (hasNotProcessedNewUpdates && // do not delay if we're inside an act() scope |
| 21688 | !( IsThisRendererActing.current)) { |
| 21689 | // If we have not processed any new updates during this pass, then |
| 21690 | // this is either a retry of an existing fallback state or a |
| 21691 | // hidden tree. Hidden trees shouldn't be batched with other work |
| 21692 | // and after that's fixed it can only be a retry. We're going to |
| 21693 | // throttle committing retries so that we don't show too many |
| 21694 | // loading states too quickly. |
| 21695 | var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time. |
no test coverage detected