You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we track event priorities in two different places:
- For transitions, we use the ReactCurrentBatchConfig object, which
lives in the secret internals object of the isomorphic package. This
is how the hook-less `startTransition` works.
- For other types of events, we use a module-level variable in
ReactEventPriorities, which is owned by the renderer.
The problem with this approach is if both priorities are set, we don't
know which one takes precedence. For example, what happens if wrap an
update in both `ReactDOM.flushSync` and `React.startTransition`?
The desired behavior is that we use the priority of whichever wrapper
is closer on the stack. So if `flushSync` is called inside of
`startTransition`, then we should use sync priority; if it's the other
way around, we should use transition priority.
To implement this, I updated the ReactEventPriorities module to track
priority on the ReactCurrentBatchConfig object instead of in a module-
level variable. Now when multiple event wrappers are nested, the inner-
most wrapper wins.
0 commit comments