Skip to content

Commit

Permalink
Bump expiration for interactive updates to 150ms in production (#12599)
Browse files Browse the repository at this point in the history
* Bump expiration for interactive updates to 150ms in production

**what is the change?:**
Changes the expiration deadline from 500ms to 150ms, only in production.
In development it will still be 500ms.

I'm thinking we may want to change the 'bucket size' too, will look into
that a bit.

**why make this change?:**
We need to ensure interactions are responsive enough in order to gather
more test data on async. mode.

**test plan:**
No tests failed - where shall we add a test for this?

* Add comments
  • Loading branch information
flarnie authored Apr 11, 2018
1 parent 3e9515e commit 915bb53
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages/react-reconciler/src/ReactFiberScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1094,8 +1094,22 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
}

function computeInteractiveExpiration(currentTime: ExpirationTime) {
// Should complete within ~500ms. 600ms max.
const expirationMs = 500;
let expirationMs;
// We intentionally set a higher expiration time for interactive updates in
// dev than in production.
// If the main thread is being blocked so long that you hit the expiration,
// it's a problem that could be solved with better scheduling.
// People will be more likely to notice this and fix it with the long
// expiration time in development.
// In production we opt for better UX at the risk of masking scheduling
// problems, by expiring fast.
if (__DEV__) {
// Should complete within ~500ms. 600ms max.
expirationMs = 500;
} else {
// In production things should be more responsive, 150ms max.
expirationMs = 150;
}
const bucketSizeMs = 100;
return computeExpirationBucket(currentTime, expirationMs, bucketSizeMs);
}
Expand Down

0 comments on commit 915bb53

Please sign in to comment.