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

Batch updates in initial render #2935

Merged
merged 1 commit into from
Jan 27, 2015

Conversation

sebmarkbage
Copy link
Collaborator

Currently, the first setState that happens during initial render will
start a new batch. Any subsequent updates will be batched. That means that
the first setState is synchronous but any subsequent setStates are
asynchronous.

This commit makes it so that the batching starts at the root. That way all
the setStates that happen within life-cycle methods are asynchronous.

@zpao
Copy link
Member

zpao commented Jan 27, 2015

Does this mean we can re-enable the callback to setState when mounting? (ie in componentWillMount - #1740)

@sebmarkbage
Copy link
Collaborator Author

No I think that is still broken but this makes it easier.

Currently, the first setState that happens during initial render will
start a new batch. Any subsequent updates will be batched. That means that
the first setState is synchronous but any subsequent setStates are
asynchronous.

This commit makes it so that the batching starts at the root. That way all
the setStates that happen within life-cycle methods are asynchronous.
sebmarkbage added a commit that referenced this pull request Jan 27, 2015
Batch updates in initial render
@sebmarkbage sebmarkbage merged commit 7e62518 into facebook:master Jan 27, 2015
sophiebits added a commit to sophiebits/react that referenced this pull request Apr 30, 2015
sophiebits added a commit to sophiebits/react that referenced this pull request Apr 30, 2015
framp pushed a commit to framp/react that referenced this pull request May 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants