Skip to content

Parallel transitions: Assign different lanes to consecutive transitions#20672

Merged
acdlite merged 2 commits into
facebook:masterfrom
acdlite:parallel-transitions
Feb 8, 2021
Merged

Parallel transitions: Assign different lanes to consecutive transitions#20672
acdlite merged 2 commits into
facebook:masterfrom
acdlite:parallel-transitions

Conversation

@acdlite
Copy link
Copy Markdown
Collaborator

@acdlite acdlite commented Jan 27, 2021

Currently we always assign the same lane to all transitions. This means if there are two pending transitions at the same time, neither transition can finish until both can finish, even if they affect completely separate parts of the UI.

The new approach is to assign a different lane to each consecutive transition, by shifting the bit to the right each time. When we reach the end of the bit range, we cycle back to the first bit. In practice, this should mean that all transitions get their own dedicated lane, unless we have more pending transitions than lanes, which should be rare.

We retain our existing behavior of assigning the same lane to all transitions within the same event. This is achieved by caching the first lane assigned to a transition, then re-using that one until the next React task, by which point the event must have finished. This preserves the guarantee that all transition updates that result from a single event will be consistent.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants