Skip to content

Commit 4184466

Browse files
committed
Lower Suspense throttling heuristic to 300ms
Now that the throttling mechanism applies more often, we've decided to lower this a tad to ensure it's not noticeable. The idea is it should be just large enough to prevent jank when lots of different parts of the UI load in rapid sucesssion, but not large enough to make the UI feel sluggish. There's no perfect number, it's just a heuristic.
1 parent e1c2b5d commit 4184466

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ let workInProgressRootRecoverableErrors: Array<CapturedValue<mixed>> | null =
375375
// content as it streams in, to minimize jank.
376376
// TODO: Think of a better name for this variable?
377377
let globalMostRecentFallbackTime: number = 0;
378-
const FALLBACK_THROTTLE_MS: number = 500;
378+
const FALLBACK_THROTTLE_MS: number = 300;
379379

380380
// The absolute time for when we should start giving up on rendering
381381
// more and prefer CPU suspense heuristics instead.

packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,8 +1863,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
18631863
// Advance by a small amount of time. For testing purposes, this is meant
18641864
// to be just under the throttling interval. It's a heurstic, though, so
18651865
// if we adjust the heuristic we might have to update this test, too.
1866-
Scheduler.unstable_advanceTime(400);
1867-
jest.advanceTimersByTime(400);
1866+
Scheduler.unstable_advanceTime(200);
1867+
jest.advanceTimersByTime(200);
18681868

18691869
// Now resolve B.
18701870
await act(async () => {

0 commit comments

Comments
 (0)