Skip to content

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Oct 31, 2016

Builds on #8127.
This is probably incomplete and there may be ways to simplify.
It removes the recursion from error handling and makes scheduling resilient to errors.

acdlite and others added 14 commits October 30, 2016 22:31
I don't think this actually changes any behavior because of the way
findNextUnitOfWork works, but I think this is easier to follow.
A bit of restructuring so that setState uses whatever the current
priority context is, like top-level render already does.

Renamed defaultPriority to priorityContext, and added a new variable
called defaultPriorityContext. Having two separate variables allows the
default to be changed without interfering with the current context.
I'll turn this on in ReactDOMFiber once I figure out batchedUpdates.
Without this fix, in non-batched mode, the update is scheduled first and
synchronously flushed before the callback is added to the queue. The
callback isn't called until the next flush.
Implements batchedUpdates and exposes as unstable_batchedUpdates. All
nested synchronous updates are automatically batched.
Turns out this isn't necessary. Simpler to keep it as one field.
Instead we'll branch on the priority level, like in scheduleWork.
This removes the only potentially recursive call in Fiber codebase by moving the error handling outside commitAllWork(), and thus, outside performUnitOfWork().
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.

3 participants