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

Replace unbatchedUpdates with flushSync #21776

Merged

Commits on Jul 1, 2021

  1. Replace unbatchedUpdates with flushSync

    There's a weird quirk leftover from the old Stack (pre-Fiber)
    implementation where the initial mount of a leagcy (ReactDOM.render)
    root is flushed synchronously even inside `batchedUpdates`.
    
    The original workaround for this was an internal method called
    `unbatchedUpdates`. We've since added another API that works almost the
    same way, `flushSync`.
    
    The only difference is that `unbatchedUpdates` would not cause other
    pending updates to flush too, only the newly mounted root. `flushSync`
    flushes all pending sync work across all roots. This was to preserve
    the exact behavior of the Stack implementation.
    
    But since it's close enough, let's just use `flushSync`. It's unlikely
    anyone's app accidentally relies on this subtle difference, and the
    legacy API is deprecated in 18, anyway.
    acdlite committed Jul 1, 2021
    Configuration menu
    Copy the full SHA
    2b25548 View commit details
    Browse the repository at this point in the history