Skip to content
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

Remove JND delay for non-transition updates #26597

Merged
merged 1 commit into from
Apr 11, 2023
Merged

Commits on Apr 11, 2023

  1. Remove JND delay for non-transition updates

    Updates that are marked as part of a transition are allowed to block a
    render from committing. Generally, other updates cannot — however,
    there's one exception that's leftover from a previous iteration of our
    Suspense architecture. If an update is not the result of a known urgent
    event type — known as "Default" updates — then we allow it to suspend
    briefly, as long as the delay is short enough that the user won't
    notice. We refer to this delay as a "Just Noticable Difference" (JND)
    delay. To illustrate, if the user has already waited 400ms for an update
    to be reflected on the screen, the theory is that they won't notice if
    you wait an additional 100ms. So React can suspend for a bit longer in
    case more data comes in. The longer the user has already waited, the
    longer the JND.
    
    While we still believe this theory is sound from a UX perspective, we no
    longer think the implementation complexity is worth it. The main thing
    that's changed is how we handle Default updates. We used to render
    Default updates concurrently (i.e. they were time sliced, and were
    scheduled with postTask), but now they are blocking. Soon, they will
    also be scheduled with rAF, too, which means by the end of the next rAF,
    they will have either finished rendering or the main thread will be
    blocked until they do. There are various motivations for this but part
    of the rationale is that anything that can be made non-blocking should
    be marked as a Transition, anyway, so it's not worth adding
    implementation complexity to Default.
    
    This commit removes the JND delay for Default updates. They will now
    commit immediately once the render phase is complete, even if a
    component suspends.
    acdlite committed Apr 11, 2023
    Configuration menu
    Copy the full SHA
    7e7e30a View commit details
    Browse the repository at this point in the history