Skip to content

ReactDOM.flushSync(batch) - #10225

Merged
acdlite merged 4 commits into
react:masterfrom
acdlite:activeupdates
Jul 21, 2017
Merged

ReactDOM.flushSync(batch)#10225
acdlite merged 4 commits into
react:masterfrom
acdlite:activeupdates

Conversation

@acdlite

Copy link
Copy Markdown
Collaborator

Updates scheduled inside of activeUpdates are flushed by the end of the current tick. In async mode, this means updates are given sync priority.

In sync mode, updates already have sync priority, so the effect of activeUpdates is to batch the updates together and flush them at the end of the batch.

Unlike unstable_batchedUpdates, activeUpdates flushes at the end even if it's nested inside another batch.

@acdlite

Copy link
Copy Markdown
CollaboratorAuthor

After some bikeshedding, we'll rename this to flushSync(batch)

@sebmarkbagesebmarkbage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted pending the new name.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we kill syncUpdates and replace the calls with this flushSync?

Updates scheduled inside of activeUpdates are flushed by the end of
the current tick. In async mode, this means updates are given sync
priority.
In sync mode, updates already have sync priority, so the effect of
activeUpdates is to batch the updates together and flush them at the
end of the batch.
Unlike unstable_batchedUpdates, activeUpdates flushes at the end even if
it's nested inside another batch.
Decided after much bikeshedding
@acdliteacdlite changed the title ReactDOM.activeUpdatesReactDOM.flushSync(batch)Jul 21, 2017
@acdlite
acdlite merged commit 0a24255 into react:masterJul 21, 2017
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@acdlite@sebmarkbage@facebook-github-bot