-
Notifications
You must be signed in to change notification settings - Fork 47.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply the Just Noticeable Difference to suspense timeouts #15367
Conversation
The problem with this PR is that since we currently estimate the event time of "hi pri" updates as 5 seconds back in time. We think that we've waited a long time so if the hi-pri update suspends we'll wait a long time. Ideally we'd estimate these times correctly, but another approach is that we cap the timeout at the expiration time like we used it. |
ReactDOM: size: 🔺+0.1%, gzip: 🔺+0.3% Details of bundled changes.Comparing: 3e2e930...f46559a react-dom
react-art
react-native-renderer
react-test-renderer
react-reconciler
Generated by 🚫 dangerJS |
// Computes the next Just Noticeable Difference (JND) boundary. | ||
// The theory is that a person can't tell the difference between small differences in time. | ||
// Therefore, if we wait a bit longer than necessary that won't translate to a noticeable | ||
// difference in the experience. However, waiting for longer might mean that we can avoid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can -> can't?
Increase the suspended time based on how long we've already waited.
The theory is that a person can't tell the difference between small differences in time. Therefore, if we wait a bit longer than necessary that won't translate to a noticeable negative difference in the experience. However, waiting for longer might mean that we can avoid showing an intermediate loading state which is a positive difference. The longer we have already waited, the harder it is to tell small differences in time. Therefore, the longer we've already waited, the longer we can wait additionally. At some point we have to give up though. We pick a train model where the next boundary commits at a consistent schedule.