Skip to content

[Fiber] Stash the entangled async action lane on currentEventTransitionLane #33188

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

Merged
merged 1 commit into from
May 13, 2025

Conversation

sebmarkbage
Copy link
Collaborator

When we're entangled with an async action lane we use that lane instead of the currentEventTransitionLane. Conversely, if we start a new async action lane we reuse the currentEventTransitionLane.

So they're basically supposed to be in sync but they're not if you resolve the async action and then schedule new stuff in the same event. Then you end up with two transitions in the same event with different lanes.

By stashing it like this we fix that but it also gives us an opportunity to check just the currentEventTransitionLane to see if this event scheduled any regular Transition updates or Async Transitions.

When we're entangled with an async action lane we use that lane
instead of the currentEventTransitionLane. Conversely, if we start a new
async action lane we reuse the currentEventTransitionLane.

So they're basically supposed to be in sync but they're not if you resolve
the async action and then schedule new stuff in the same event. Then you
end up with two transitions in the same event with different lanes.

By stashing it like this we fix that but it also gives us an opportunity to
check just the currentEventTransitionLane to see if this event scheduled
any regular Transition updates or Async Transitions.
@sebmarkbage sebmarkbage requested a review from acdlite May 13, 2025 15:34
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label May 13, 2025
@react-sizebot
Copy link

Comparing: b94603b...8ca193d

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 528.09 kB 528.09 kB = 93.17 kB 93.17 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 646.40 kB 646.44 kB +0.02% 113.71 kB 113.73 kB
facebook-www/ReactDOM-prod.classic.js = 674.15 kB 674.14 kB = 118.41 kB 118.41 kB
facebook-www/ReactDOM-prod.modern.js = 664.43 kB 664.42 kB = 116.81 kB 116.80 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.production.js +0.47% 214.14 kB 215.15 kB +0.38% 39.06 kB 39.21 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.production.js +0.47% 214.17 kB 215.18 kB +0.38% 39.08 kB 39.23 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.js +0.46% 218.66 kB 219.67 kB +0.35% 40.81 kB 40.95 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.js +0.46% 218.68 kB 219.69 kB +0.35% 40.83 kB 40.98 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.js +0.41% 235.78 kB 236.75 kB +0.35% 42.99 kB 43.14 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.js +0.41% 235.86 kB 236.83 kB +0.35% 43.01 kB 43.16 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.production.js +0.41% 219.11 kB 220.00 kB +0.31% 40.36 kB 40.49 kB
oss-stable/react-dom/cjs/react-dom-server.bun.production.js +0.41% 219.19 kB 220.08 kB +0.31% 40.39 kB 40.52 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.production.js +0.41% 233.99 kB 234.94 kB +0.28% 42.04 kB 42.16 kB
oss-stable/react-dom/cjs/react-dom-server.browser.production.js +0.41% 234.06 kB 235.01 kB +0.28% 42.06 kB 42.18 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.production.js +0.40% 239.19 kB 240.14 kB +0.32% 43.98 kB 44.12 kB
oss-stable/react-dom/cjs/react-dom-server.edge.production.js +0.40% 239.27 kB 240.22 kB +0.31% 44.00 kB 44.14 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js +0.36% 365.72 kB 367.05 kB +0.26% 66.46 kB 66.63 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.36% 365.72 kB 367.05 kB +0.26% 66.46 kB 66.63 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js +0.36% 365.74 kB 367.07 kB +0.26% 66.48 kB 66.66 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js +0.36% 365.74 kB 367.08 kB +0.26% 66.48 kB 66.66 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js +0.31% 382.83 kB 384.02 kB +0.18% 68.90 kB 69.02 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js +0.31% 382.91 kB 384.10 kB +0.18% 68.95 kB 69.07 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js +0.31% 383.61 kB 384.80 kB +0.18% 69.04 kB 69.16 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js +0.31% 383.69 kB 384.88 kB +0.18% 69.09 kB 69.22 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js +0.30% 379.36 kB 380.51 kB +0.17% 68.26 kB 68.38 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js +0.30% 379.43 kB 380.59 kB +0.17% 68.31 kB 68.43 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.development.js +0.30% 326.44 kB 327.43 kB +0.21% 63.56 kB 63.69 kB
oss-stable/react-dom/cjs/react-dom-server.bun.development.js +0.30% 326.52 kB 327.51 kB +0.21% 63.59 kB 63.72 kB

Generated by 🚫 dangerJS against 8ca193d

@sebmarkbage sebmarkbage merged commit 0cac32d into facebook:main May 13, 2025
245 checks passed
github-actions bot pushed a commit that referenced this pull request May 13, 2025
…onLane (#33188)

When we're entangled with an async action lane we use that lane instead
of the currentEventTransitionLane. Conversely, if we start a new async
action lane we reuse the currentEventTransitionLane.

So they're basically supposed to be in sync but they're not if you
resolve the async action and then schedule new stuff in the same event.
Then you end up with two transitions in the same event with different
lanes.

By stashing it like this we fix that but it also gives us an opportunity
to check just the currentEventTransitionLane to see if this event
scheduled any regular Transition updates or Async Transitions.

DiffTrain build for [0cac32d](0cac32d)
github-actions bot pushed a commit that referenced this pull request May 13, 2025
…onLane (#33188)

When we're entangled with an async action lane we use that lane instead
of the currentEventTransitionLane. Conversely, if we start a new async
action lane we reuse the currentEventTransitionLane.

So they're basically supposed to be in sync but they're not if you
resolve the async action and then schedule new stuff in the same event.
Then you end up with two transitions in the same event with different
lanes.

By stashing it like this we fix that but it also gives us an opportunity
to check just the currentEventTransitionLane to see if this event
scheduled any regular Transition updates or Async Transitions.

DiffTrain build for [0cac32d](0cac32d)
sebmarkbage added a commit that referenced this pull request May 13, 2025
…o root associated (#33190)

Stacked on #33160, #33162, #33186 and #33188.

We have a special case that's awkward for default indicators. When you
start a new async Transition from `React.startTransition` then there's
not yet any associated root with the Transition because you haven't
necessarily `setState` on anything yet until the promise resolves.
That's what `entangleAsyncAction` handles by creating a lane that
everything entangles with until all async actions are done.

If there are no sync updates before the end of the event, we should
trigger a default indicator until either the async action completes
without update or if it gets entangled with some roots we should keep it
going until those roots are done.
github-actions bot pushed a commit that referenced this pull request May 13, 2025
…o root associated (#33190)

Stacked on #33160, #33162, #33186 and #33188.

We have a special case that's awkward for default indicators. When you
start a new async Transition from `React.startTransition` then there's
not yet any associated root with the Transition because you haven't
necessarily `setState` on anything yet until the promise resolves.
That's what `entangleAsyncAction` handles by creating a lane that
everything entangles with until all async actions are done.

If there are no sync updates before the end of the event, we should
trigger a default indicator until either the async action completes
without update or if it gets entangled with some roots we should keep it
going until those roots are done.

DiffTrain build for [3a5b326](3a5b326)
github-actions bot pushed a commit that referenced this pull request May 13, 2025
…o root associated (#33190)

Stacked on #33160, #33162, #33186 and #33188.

We have a special case that's awkward for default indicators. When you
start a new async Transition from `React.startTransition` then there's
not yet any associated root with the Transition because you haven't
necessarily `setState` on anything yet until the promise resolves.
That's what `entangleAsyncAction` handles by creating a lane that
everything entangles with until all async actions are done.

If there are no sync updates before the end of the event, we should
trigger a default indicator until either the async action completes
without update or if it gets entangled with some roots we should keep it
going until those roots are done.

DiffTrain build for [3a5b326](3a5b326)
github-actions bot pushed a commit to code/lib-react that referenced this pull request May 14, 2025
…o root associated (facebook#33190)

Stacked on facebook#33160, facebook#33162, facebook#33186 and facebook#33188.

We have a special case that's awkward for default indicators. When you
start a new async Transition from `React.startTransition` then there's
not yet any associated root with the Transition because you haven't
necessarily `setState` on anything yet until the promise resolves.
That's what `entangleAsyncAction` handles by creating a lane that
everything entangles with until all async actions are done.

If there are no sync updates before the end of the event, we should
trigger a default indicator until either the async action completes
without update or if it gets entangled with some roots we should keep it
going until those roots are done.

DiffTrain build for [3a5b326](facebook@3a5b326)
github-actions bot pushed a commit to code/lib-react that referenced this pull request May 14, 2025
…o root associated (facebook#33190)

Stacked on facebook#33160, facebook#33162, facebook#33186 and facebook#33188.

We have a special case that's awkward for default indicators. When you
start a new async Transition from `React.startTransition` then there's
not yet any associated root with the Transition because you haven't
necessarily `setState` on anything yet until the promise resolves.
That's what `entangleAsyncAction` handles by creating a lane that
everything entangles with until all async actions are done.

If there are no sync updates before the end of the event, we should
trigger a default indicator until either the async action completes
without update or if it gets entangled with some roots we should keep it
going until those roots are done.

DiffTrain build for [3a5b326](facebook@3a5b326)
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.

4 participants