@samitouri / QOS-React / commits / d1f2143aa6

Use RetryLanes instead of event time (follow up) (#19335)

Same logic as #19307. Uses RetryLanes instead of event time to determine if a render includes new updates.

Andrew Clark committed Jul 13, 2020 at 12:37 UTC d1f2143aa6f2bba622b244e296ccb89e1c6a7495
2 files changed +6 -14
packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+3 -7
@@ -2689,16 +2689,12 @@ export function pingSuspendedRoot(
2689 // TODO: If we're rendering sync either due to Sync, Batched or expired,
2690 // we should probably never restart.
2691
2692 - // If we're suspended with delay, we'll always suspend so we can always
2693 - // restart. If we're suspended without any updates, it might be a retry.
2694 - // If it's early in the retry we can restart. We can't know for sure
2695 - // whether we'll eventually process an update during this render pass,
2696 - // but it's somewhat unlikely that we get to a ping before that, since
2697 - // getting to the root most update is usually very fast.
2692 + // If we're suspended with delay, or if it's a retry, we'll always suspend
2693 + // so we can always restart.
2694 if (
2695 workInProgressRootExitStatus === RootSuspendedWithDelay ||
2696 (workInProgressRootExitStatus === RootSuspended &&
2701 - workInProgressRootLatestProcessedEventTime === NoTimestamp &&
2697 + includesOnlyRetries(workInProgressRootRenderLanes) &&
2698 now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS)
2699 ) {
2700 // Restart from the root.
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+3 -7
@@ -2836,16 +2836,12 @@ export function pingSuspendedRoot(
2836 // TODO: If we're rendering sync either due to Sync, Batched or expired,
2837 // we should probably never restart.
2838
2839 - // If we're suspended with delay, we'll always suspend so we can always
2840 - // restart. If we're suspended without any updates, it might be a retry.
2841 - // If it's early in the retry we can restart. We can't know for sure
2842 - // whether we'll eventually process an update during this render pass,
2843 - // but it's somewhat unlikely that we get to a ping before that, since
2844 - // getting to the root most update is usually very fast.
2839 + // If we're suspended with delay, or if it's a retry, we'll always suspend
2840 + // so we can always restart.
2841 if (
2842 workInProgressRootExitStatus === RootSuspendedWithDelay ||
2843 (workInProgressRootExitStatus === RootSuspended &&
2848 - workInProgressRootLatestProcessedEventTime === NoTimestamp &&
2844 + includesOnlyRetries(workInProgressRootRenderLanes) &&
2845 now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS)
2846 ) {
2847 // Restart from the root.