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

[Fiber] Move updatePriority tracking to renderers #28751

Merged
merged 4 commits into from
Apr 8, 2024

Commits on Apr 4, 2024

  1. [Fiber] Move updatePriority tracking to renderers

    Current updatePriority is tracked in the reconciler. `flushSync` is going to be implemented reconciler agnostic soon and we need to move the tracking of this state to the renderer and out of reconciler. This change implements new renderer bin
    dings for getCurrentUpdatePriority and setCurrentUpdatePriority.
    
    I was originally going to have the getter also do the event priority defaulting using window.event so we eliminate getCur
    rentEventPriority but this makes all the callsites where we store the true current updatePriority on the stack harder to
    work with so for now they remain separate.
    
    I also moved runWithPriority to the renderer since it really belongs whereever the state is being managed and it is only
    currently exposed in the DOM renderer.
    gnoff committed Apr 4, 2024
    Configuration menu
    Copy the full SHA
    d43dd65 View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2024

  1. Moves currentUpdatePriority to ReactDOMSharedInternals. While not par…

    …ticularly meaningful in this change this demonstrates how we can use this to implement flushSync in a way that does not require the reconciler being loaded so it can be used in the top-level entrypoint without pulling in the reconciler
    gnoff committed Apr 5, 2024
    Configuration menu
    Copy the full SHA
    2a00183 View commit details
    Browse the repository at this point in the history
  2. refactors the currentUpdatePriority apis to more clearly communicate …

    …when you are reading a raw value and when you are getting a resolved value. This allows requestUpdateLane to do a single call into the renderer to get the update priority while still making a reasonable stack based updating of update priorities ergonomic. I had to expose a `peekCurrentUpdatePriority` to satisfy startTransition which needs to set a new priority only if the current one is too low. I tried to stay away from get/set naming to avoid potential issues with whether you are reading the raw value or the derived one that considers window.event
    gnoff committed Apr 5, 2024
    Configuration menu
    Copy the full SHA
    fcbb369 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5d28591 View commit details
    Browse the repository at this point in the history