mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Lower Suspense throttling heuristic to 300ms (#26803)
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 succession, but not large enough to make the UI feel sluggish. There's no perfect number, it's just a heuristic.
This commit is contained in:
@@ -375,7 +375,7 @@ let workInProgressRootRecoverableErrors: Array<CapturedValue<mixed>> | null =
|
||||
// content as it streams in, to minimize jank.
|
||||
// TODO: Think of a better name for this variable?
|
||||
let globalMostRecentFallbackTime: number = 0;
|
||||
const FALLBACK_THROTTLE_MS: number = 500;
|
||||
const FALLBACK_THROTTLE_MS: number = 300;
|
||||
|
||||
// The absolute time for when we should start giving up on rendering
|
||||
// more and prefer CPU suspense heuristics instead.
|
||||
|
||||
@@ -1863,8 +1863,8 @@ describe('ReactSuspenseWithNoopRenderer', () => {
|
||||
// Advance by a small amount of time. For testing purposes, this is meant
|
||||
// to be just under the throttling interval. It's a heurstic, though, so
|
||||
// if we adjust the heuristic we might have to update this test, too.
|
||||
Scheduler.unstable_advanceTime(400);
|
||||
jest.advanceTimersByTime(400);
|
||||
Scheduler.unstable_advanceTime(200);
|
||||
jest.advanceTimersByTime(200);
|
||||
|
||||
// Now resolve B.
|
||||
await act(async () => {
|
||||
|
||||
Reference in New Issue
Block a user