Skip to content

Commit d76abdf

Browse files
committed
[Fiber] Stash the entangled async action lane on currentEventTransitionLane (#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)
1 parent b418aef commit d76abdf

34 files changed

+294
-264
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3820740a7fbfc3b27a5127b43bdad44382ff3ce0
1+
0cac32d60dd4482b27fe8a54dffbabceb22c6272
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3820740a7fbfc3b27a5127b43bdad44382ff3ce0
1+
0cac32d60dd4482b27fe8a54dffbabceb22c6272

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ __DEV__ &&
15371537
exports.useTransition = function () {
15381538
return resolveDispatcher().useTransition();
15391539
};
1540-
exports.version = "19.2.0-www-classic-3820740a-20250509";
1540+
exports.version = "19.2.0-www-classic-0cac32d6-20250513";
15411541
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15421542
"function" ===
15431543
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ __DEV__ &&
15371537
exports.useTransition = function () {
15381538
return resolveDispatcher().useTransition();
15391539
};
1540-
exports.version = "19.2.0-www-modern-3820740a-20250509";
1540+
exports.version = "19.2.0-www-modern-0cac32d6-20250513";
15411541
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15421542
"function" ===
15431543
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,4 +635,4 @@ exports.useSyncExternalStore = function (
635635
exports.useTransition = function () {
636636
return ReactSharedInternals.H.useTransition();
637637
};
638-
exports.version = "19.2.0-www-classic-3820740a-20250509";
638+
exports.version = "19.2.0-www-classic-0cac32d6-20250513";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,4 +635,4 @@ exports.useSyncExternalStore = function (
635635
exports.useTransition = function () {
636636
return ReactSharedInternals.H.useTransition();
637637
};
638-
exports.version = "19.2.0-www-modern-3820740a-20250509";
638+
exports.version = "19.2.0-www-modern-0cac32d6-20250513";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ exports.useSyncExternalStore = function (
639639
exports.useTransition = function () {
640640
return ReactSharedInternals.H.useTransition();
641641
};
642-
exports.version = "19.2.0-www-classic-3820740a-20250509";
642+
exports.version = "19.2.0-www-classic-0cac32d6-20250513";
643643
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
644644
"function" ===
645645
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ exports.useSyncExternalStore = function (
639639
exports.useTransition = function () {
640640
return ReactSharedInternals.H.useTransition();
641641
};
642-
exports.version = "19.2.0-www-modern-3820740a-20250509";
642+
exports.version = "19.2.0-www-modern-0cac32d6-20250513";
643643
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
644644
"function" ===
645645
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,7 +2818,6 @@ __DEV__ &&
28182818
didScheduleMicrotask_act =
28192819
didScheduleMicrotask =
28202820
!1;
2821-
0 !== currentEventTransitionLane && (currentEventTransitionLane = 0);
28222821
for (
28232822
var currentTime = now$1(), prev = null, root = firstScheduledRoot;
28242823
null !== root;
@@ -2837,6 +2836,7 @@ __DEV__ &&
28372836
(pendingEffectsStatus !== NO_PENDING_EFFECTS &&
28382837
pendingEffectsStatus !== PENDING_PASSIVE_PHASE) ||
28392838
flushSyncWorkAcrossRoots_impl(0, !1);
2839+
currentEventTransitionLane = 0;
28402840
}
28412841
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
28422842
var pendingLanes = root.pendingLanes,
@@ -2971,8 +2971,11 @@ __DEV__ &&
29712971
scheduleCallback$3(ImmediatePriority, processRootScheduleInImmediateTask);
29722972
}
29732973
function requestTransitionLane() {
2974-
0 === currentEventTransitionLane &&
2975-
(currentEventTransitionLane = claimNextTransitionLane());
2974+
if (0 === currentEventTransitionLane) {
2975+
var actionScopeLane = currentEntangledLane;
2976+
currentEventTransitionLane =
2977+
0 !== actionScopeLane ? actionScopeLane : claimNextTransitionLane();
2978+
}
29762979
return currentEventTransitionLane;
29772980
}
29782981
function entangleAsyncAction(transition, thenable) {
@@ -13911,8 +13914,7 @@ __DEV__ &&
1391113914
return null !== transition
1391213915
? (transition._updatedFibers || (transition._updatedFibers = new Set()),
1391313916
transition._updatedFibers.add(fiber),
13914-
(fiber = currentEntangledLane),
13915-
0 !== fiber ? fiber : requestTransitionLane())
13917+
requestTransitionLane())
1391613918
: currentUpdatePriority || DefaultEventPriority;
1391713919
}
1391813920
function requestDeferredLane() {
@@ -19065,10 +19067,10 @@ __DEV__ &&
1906519067
(function () {
1906619068
var internals = {
1906719069
bundleType: 1,
19068-
version: "19.2.0-www-classic-3820740a-20250509",
19070+
version: "19.2.0-www-classic-0cac32d6-20250513",
1906919071
rendererPackageName: "react-art",
1907019072
currentDispatcherRef: ReactSharedInternals,
19071-
reconcilerVersion: "19.2.0-www-classic-3820740a-20250509"
19073+
reconcilerVersion: "19.2.0-www-classic-0cac32d6-20250513"
1907219074
};
1907319075
internals.overrideHookState = overrideHookState;
1907419076
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19102,7 +19104,7 @@ __DEV__ &&
1910219104
exports.Shape = Shape;
1910319105
exports.Surface = Surface;
1910419106
exports.Text = Text;
19105-
exports.version = "19.2.0-www-classic-3820740a-20250509";
19107+
exports.version = "19.2.0-www-classic-0cac32d6-20250513";
1910619108
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1910719109
"function" ===
1910819110
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,7 +2724,6 @@ __DEV__ &&
27242724
didScheduleMicrotask_act =
27252725
didScheduleMicrotask =
27262726
!1;
2727-
0 !== currentEventTransitionLane && (currentEventTransitionLane = 0);
27282727
for (
27292728
var currentTime = now$1(), prev = null, root = firstScheduledRoot;
27302729
null !== root;
@@ -2743,6 +2742,7 @@ __DEV__ &&
27432742
(pendingEffectsStatus !== NO_PENDING_EFFECTS &&
27442743
pendingEffectsStatus !== PENDING_PASSIVE_PHASE) ||
27452744
flushSyncWorkAcrossRoots_impl(0, !1);
2745+
currentEventTransitionLane = 0;
27462746
}
27472747
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
27482748
var pendingLanes = root.pendingLanes,
@@ -2877,8 +2877,11 @@ __DEV__ &&
28772877
scheduleCallback$3(ImmediatePriority, processRootScheduleInImmediateTask);
28782878
}
28792879
function requestTransitionLane() {
2880-
0 === currentEventTransitionLane &&
2881-
(currentEventTransitionLane = claimNextTransitionLane());
2880+
if (0 === currentEventTransitionLane) {
2881+
var actionScopeLane = currentEntangledLane;
2882+
currentEventTransitionLane =
2883+
0 !== actionScopeLane ? actionScopeLane : claimNextTransitionLane();
2884+
}
28822885
return currentEventTransitionLane;
28832886
}
28842887
function entangleAsyncAction(transition, thenable) {
@@ -13729,8 +13732,7 @@ __DEV__ &&
1372913732
return null !== transition
1373013733
? (transition._updatedFibers || (transition._updatedFibers = new Set()),
1373113734
transition._updatedFibers.add(fiber),
13732-
(fiber = currentEntangledLane),
13733-
0 !== fiber ? fiber : requestTransitionLane())
13735+
requestTransitionLane())
1373413736
: currentUpdatePriority || DefaultEventPriority;
1373513737
}
1373613738
function requestDeferredLane() {
@@ -18837,10 +18839,10 @@ __DEV__ &&
1883718839
(function () {
1883818840
var internals = {
1883918841
bundleType: 1,
18840-
version: "19.2.0-www-modern-3820740a-20250509",
18842+
version: "19.2.0-www-modern-0cac32d6-20250513",
1884118843
rendererPackageName: "react-art",
1884218844
currentDispatcherRef: ReactSharedInternals,
18843-
reconcilerVersion: "19.2.0-www-modern-3820740a-20250509"
18845+
reconcilerVersion: "19.2.0-www-modern-0cac32d6-20250513"
1884418846
};
1884518847
internals.overrideHookState = overrideHookState;
1884618848
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -18874,7 +18876,7 @@ __DEV__ &&
1887418876
exports.Shape = Shape;
1887518877
exports.Surface = Surface;
1887618878
exports.Text = Text;
18877-
exports.version = "19.2.0-www-modern-3820740a-20250509";
18879+
exports.version = "19.2.0-www-modern-0cac32d6-20250513";
1887818880
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1887918881
"function" ===
1888018882
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)