GeezerVison is showing github.com — Decrease expiration time of input updates (#19772) · react/react@708fa77
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/react-reconciler/src
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberLane.js +15-1Lines changed: 15 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -384,7 +384,21 @@ function computeExpirationTime(lane: Lane, currentTime: number) { |
384 | 384 | const priority = return_highestLanePriority; |
385 | 385 | if (priority >= InputContinuousLanePriority) { |
386 | 386 | // User interactions should expire slightly more quickly. |
387 | | - return currentTime + 1000; |
| 387 | + // |
| 388 | + // NOTE: This is set to the corresponding constant as in Scheduler.js. When |
| 389 | + // we made it larger, a product metric in www regressed, suggesting there's |
| 390 | + // a user interaction that's being starved by a series of synchronous |
| 391 | + // updates. If that theory is correct, the proper solution is to fix the |
| 392 | + // starvation. However, this scenario supports the idea that expiration |
| 393 | + // times are an important safeguard when starvation does happen. |
| 394 | + // |
| 395 | + // Also note that, in the case of user input specifically, this will soon no |
| 396 | + // longer be an issue because we plan to make user input synchronous by |
| 397 | + // default (until you enter `startTransition`, of course.) |
| 398 | + // |
| 399 | + // If weren't planning to make these updates synchronous soon anyway, I |
| 400 | + // would probably make this number a configurable parameter. |
| 401 | + return currentTime + 250; |
388 | 402 | } else if (priority >= TransitionPriority) { |
389 | 403 | return currentTime + 5000; |
390 | 404 | } else { |
|