Skip to content

Commit f396149

Browse files
committed
SuspenseList: Reschedule at same priority
SuspenseList progressively renders items even if the list is CPU bound, i.e. it isn't waiting for missing data. It does this by showing a fallback for the remaining items, committing the items in that have already finished, then starting a new render to continue working on the rest. When it schedules that subsequent render, it uses a slightly lower priority than the current render: `renderExpirationTime - 1`. This commit changes it to reschedule at `renderExpirationTime` instead. I don't know what the original motivation was for bumping the expiration time slightly lower. The comment says that the priorities of the two renders are the same (which makes sense to me) so I imagine it was motivated by some implementation detail. I don't think it's necessary anymore, though perhaps it was when it was originally written. If it is still necessary, we should write a test case that illustrates why.
1 parent c40d206 commit f396149

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

packages/react-reconciler/src/ReactFiberCompleteWork.new.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,7 @@ import {
128128
popRenderExpirationTime,
129129
} from './ReactFiberWorkLoop.new';
130130
import {createFundamentalStateInstance} from './ReactFiberFundamental.new';
131-
import {
132-
Never,
133-
isSameOrHigherPriority,
134-
bumpPriorityLower,
135-
} from './ReactFiberExpirationTime.new';
131+
import {Never, isSameOrHigherPriority} from './ReactFiberExpirationTime.new';
136132
import {resetChildFibers} from './ReactChildFiber.new';
137133
import {updateDeprecatedEventListeners} from './ReactFiberDeprecatedEvents.new';
138134
import {createScopeMethods} from './ReactFiberScope.new';
@@ -1119,11 +1115,9 @@ function completeWork(
11191115
// them, then they really have the same priority as this render.
11201116
// So we'll pick it back up the very next render pass once we've had
11211117
// an opportunity to yield for paint.
1122-
1123-
const nextPriority = bumpPriorityLower(renderExpirationTime);
1124-
workInProgress.expirationTime_opaque = workInProgress.childExpirationTime_opaque = nextPriority;
1118+
workInProgress.expirationTime_opaque = workInProgress.childExpirationTime_opaque = renderExpirationTime;
11251119
if (enableSchedulerTracing) {
1126-
markSpawnedWork(nextPriority);
1120+
markSpawnedWork(renderExpirationTime);
11271121
}
11281122
}
11291123
}

0 commit comments

Comments
 (0)