@samitouri / QOS-React / commits / df61e708c8

Remove check in renderDidSuspendDelayIfPossible (#25630)

I don't think we need this anymore. It was added originally because RootSuspended would take priority over RootSuspendedWithDelay. But we've since changed it: any "bad" fallback state is permitted to block a "good" fallback state. The other status flags that this check used to account for are RootDidNotComplete and RootFatalErrored: - RootFatalErrored is like an invariant violation, it means something went really wrong already and we can't recover from it - RootCompleted and RootDidNotComplete are only set at the very end of the work loop, there's no way for renderDidSuspendDelayIfPossible to sneak in after that (at least none that I can think of — it's only called from the render phase) So I think we can just delete this. It's entirely possible there's some scenario I haven't considered, though, which is why I'm submitting this change as its own PR. To preserve the ability to bisect to it later.

Andrew Clark committed Nov 3, 2022 at 13:15 UTC df61e708c82134133e002f8559c19d4897204b54
2 files changed +2 -14
packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+1 -7
@@ -1926,13 +1926,7 @@ export function renderDidSuspend(): void {
1926 }
1927
1928 export function renderDidSuspendDelayIfPossible(): void {
1929 - if (
1930 - workInProgressRootExitStatus === RootInProgress ||
1931 - workInProgressRootExitStatus === RootSuspended ||
1932 - workInProgressRootExitStatus === RootErrored
1933 - ) {
1934 - workInProgressRootExitStatus = RootSuspendedWithDelay;
1935 - }
1929 + workInProgressRootExitStatus = RootSuspendedWithDelay;
1930
1931 // Check if there are updates that we skipped tree that might have unblocked
1932 // this render.
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+1 -7
@@ -1926,13 +1926,7 @@ export function renderDidSuspend(): void {
1926 }
1927
1928 export function renderDidSuspendDelayIfPossible(): void {
1929 - if (
1930 - workInProgressRootExitStatus === RootInProgress ||
1931 - workInProgressRootExitStatus === RootSuspended ||
1932 - workInProgressRootExitStatus === RootErrored
1933 - ) {
1934 - workInProgressRootExitStatus = RootSuspendedWithDelay;
1935 - }
1929 + workInProgressRootExitStatus = RootSuspendedWithDelay;
1930
1931 // Check if there are updates that we skipped tree that might have unblocked
1932 // this render.