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

Remove didCommit from scheduler #10182

Merged
merged 1 commit into from
Jul 14, 2017
Merged

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Jul 13, 2017

Don't actually need to track this, now that we moved the infinite loop check to findNextUnitOfWork.

Don't actually need to track this, now that we removed the infinite
loop check to findNextUnitOfWork
(nextPriorityLevel === TaskPriority ||
nextPriorityLevel === SynchronousPriority)
nextPriorityLevel === TaskPriority ||
nextPriorityLevel === SynchronousPriority
Copy link
Collaborator

Choose a reason for hiding this comment

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

So, we can still infinite loop with async updates?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My reasoning is that it's always ok to do an async update in componentDidUpdate because it's non-blocking. So we shouldn't ever throw this error for an async update. E.g. If you do LIMIT - 1 nested sync updates, and then an additional async update, that should be fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

...well that example is bad now that the check is in findNextUnitOfWork. Here's a better one: if you commit at async priority, then you have remaining time, so you commit again at a lower priority, that's not a nested update, it's just two separate priority levels. By adding this check, we know we're only counting updates that were scheduled in the previous commit phase.

The other way we could implement this is by counting the number of commits in which setState is called at least once. Then we don't have to do a priority check. Now that I think about it, that might be more elegant.

@acdlite acdlite merged commit fb30d23 into facebook:master Jul 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants