Skip to content

Commit 10fb97e

Browse files
committed
[Fiber] Track SuspendedState on stack instead of global (#34486)
Stacked on #34481. We currently track the suspended state temporarily with a global which is safe as long as we always read it during a sync pass. However, we sometimes read it in closures and then we have to be carefully to pass the right one since it's possible another commit on a different root has started at that point. This avoids this footgun. Another reason to do this is that I want to read it in `startViewTransition` which is in an async gap after which point it's no longer safe. So I have to pass that through the `commitRoot` bound function. DiffTrain build for [5d49b2b](5d49b2b)
1 parent a681a4f commit 10fb97e

34 files changed

+1614
-1008
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ae22247dce1449574cd324cae0d8aa0d4824a937
1+
5d49b2b7f42b6aebe749914fbd06640ded63c001
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ae22247dce1449574cd324cae0d8aa0d4824a937
1+
5d49b2b7f42b6aebe749914fbd06640ded63c001

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ __DEV__ &&
14191419
exports.useTransition = function () {
14201420
return resolveDispatcher().useTransition();
14211421
};
1422-
exports.version = "19.2.0-www-classic-ae22247d-20250915";
1422+
exports.version = "19.2.0-www-classic-5d49b2b7-20250915";
14231423
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14241424
"function" ===
14251425
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
@@ -1419,7 +1419,7 @@ __DEV__ &&
14191419
exports.useTransition = function () {
14201420
return resolveDispatcher().useTransition();
14211421
};
1422-
exports.version = "19.2.0-www-modern-ae22247d-20250915";
1422+
exports.version = "19.2.0-www-modern-5d49b2b7-20250915";
14231423
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14241424
"function" ===
14251425
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
@@ -602,4 +602,4 @@ exports.useSyncExternalStore = function (
602602
exports.useTransition = function () {
603603
return ReactSharedInternals.H.useTransition();
604604
};
605-
exports.version = "19.2.0-www-classic-ae22247d-20250915";
605+
exports.version = "19.2.0-www-classic-5d49b2b7-20250915";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,4 +602,4 @@ exports.useSyncExternalStore = function (
602602
exports.useTransition = function () {
603603
return ReactSharedInternals.H.useTransition();
604604
};
605-
exports.version = "19.2.0-www-modern-ae22247d-20250915";
605+
exports.version = "19.2.0-www-modern-5d49b2b7-20250915";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ exports.useSyncExternalStore = function (
606606
exports.useTransition = function () {
607607
return ReactSharedInternals.H.useTransition();
608608
};
609-
exports.version = "19.2.0-www-classic-ae22247d-20250915";
609+
exports.version = "19.2.0-www-classic-5d49b2b7-20250915";
610610
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
611611
"function" ===
612612
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
@@ -606,7 +606,7 @@ exports.useSyncExternalStore = function (
606606
exports.useTransition = function () {
607607
return ReactSharedInternals.H.useTransition();
608608
};
609-
exports.version = "19.2.0-www-modern-ae22247d-20250915";
609+
exports.version = "19.2.0-www-modern-5d49b2b7-20250915";
610610
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
611611
"function" ===
612612
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14853,6 +14853,7 @@ __DEV__ &&
1485314853
workInProgressRootInterleavedUpdatedLanes,
1485414854
workInProgressSuspendedRetryLanes,
1485514855
startTime,
14856+
null,
1485614857
IMMEDIATE_COMMIT,
1485714858
renderStartTime,
1485814859
forceSync
@@ -14937,12 +14938,13 @@ __DEV__ &&
1493714938
) {
1493814939
root.timeoutHandle = -1;
1493914940
didSkipSuspendedSiblings = finishedWork.subtreeFlags;
14941+
var suspendedState = null;
1494014942
if (
1494114943
(enableViewTransition && (lanes & 335544064) === lanes) ||
1494214944
didSkipSuspendedSiblings & 8192 ||
1494314945
16785408 === (didSkipSuspendedSiblings & 16785408)
1494414946
)
14945-
(appearingViewTransitions = null),
14947+
(appearingViewTransitions = suspendedState = null),
1494614948
accumulateSuspenseyCommitOnFiber(finishedWork),
1494714949
(lanes & 62914560) === lanes
1494814950
? globalMostRecentFallbackTime - now$1()
@@ -14960,6 +14962,7 @@ __DEV__ &&
1496014962
updatedLanes,
1496114963
suspendedRetryLanes,
1496214964
exitStatus,
14965+
suspendedState,
1496314966
suspendedCommitReason,
1496414967
completedRenderStartTime,
1496514968
completedRenderEndTime
@@ -15994,6 +15997,7 @@ __DEV__ &&
1599415997
updatedLanes,
1599515998
suspendedRetryLanes,
1599615999
exitStatus,
16000+
suspendedState,
1599716001
suspendedCommitReason,
1599816002
completedRenderStartTime,
1599916003
completedRenderEndTime
@@ -19761,10 +19765,10 @@ __DEV__ &&
1976119765
(function () {
1976219766
var internals = {
1976319767
bundleType: 1,
19764-
version: "19.2.0-www-classic-ae22247d-20250915",
19768+
version: "19.2.0-www-classic-5d49b2b7-20250915",
1976519769
rendererPackageName: "react-art",
1976619770
currentDispatcherRef: ReactSharedInternals,
19767-
reconcilerVersion: "19.2.0-www-classic-ae22247d-20250915"
19771+
reconcilerVersion: "19.2.0-www-classic-5d49b2b7-20250915"
1976819772
};
1976919773
internals.overrideHookState = overrideHookState;
1977019774
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19798,7 +19802,7 @@ __DEV__ &&
1979819802
exports.Shape = Shape;
1979919803
exports.Surface = Surface;
1980019804
exports.Text = Text;
19801-
exports.version = "19.2.0-www-classic-ae22247d-20250915";
19805+
exports.version = "19.2.0-www-classic-5d49b2b7-20250915";
1980219806
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1980319807
"function" ===
1980419808
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14671,6 +14671,7 @@ __DEV__ &&
1467114671
workInProgressRootInterleavedUpdatedLanes,
1467214672
workInProgressSuspendedRetryLanes,
1467314673
startTime,
14674+
null,
1467414675
IMMEDIATE_COMMIT,
1467514676
renderStartTime,
1467614677
forceSync
@@ -14755,12 +14756,13 @@ __DEV__ &&
1475514756
) {
1475614757
root.timeoutHandle = -1;
1475714758
didSkipSuspendedSiblings = finishedWork.subtreeFlags;
14759+
var suspendedState = null;
1475814760
if (
1475914761
(enableViewTransition && (lanes & 335544064) === lanes) ||
1476014762
didSkipSuspendedSiblings & 8192 ||
1476114763
16785408 === (didSkipSuspendedSiblings & 16785408)
1476214764
)
14763-
(appearingViewTransitions = null),
14765+
(appearingViewTransitions = suspendedState = null),
1476414766
accumulateSuspenseyCommitOnFiber(finishedWork),
1476514767
(lanes & 62914560) === lanes
1476614768
? globalMostRecentFallbackTime - now$1()
@@ -14778,6 +14780,7 @@ __DEV__ &&
1477814780
updatedLanes,
1477914781
suspendedRetryLanes,
1478014782
exitStatus,
14783+
suspendedState,
1478114784
suspendedCommitReason,
1478214785
completedRenderStartTime,
1478314786
completedRenderEndTime
@@ -15807,6 +15810,7 @@ __DEV__ &&
1580715810
updatedLanes,
1580815811
suspendedRetryLanes,
1580915812
exitStatus,
15813+
suspendedState,
1581015814
suspendedCommitReason,
1581115815
completedRenderStartTime,
1581215816
completedRenderEndTime
@@ -19532,10 +19536,10 @@ __DEV__ &&
1953219536
(function () {
1953319537
var internals = {
1953419538
bundleType: 1,
19535-
version: "19.2.0-www-modern-ae22247d-20250915",
19539+
version: "19.2.0-www-modern-5d49b2b7-20250915",
1953619540
rendererPackageName: "react-art",
1953719541
currentDispatcherRef: ReactSharedInternals,
19538-
reconcilerVersion: "19.2.0-www-modern-ae22247d-20250915"
19542+
reconcilerVersion: "19.2.0-www-modern-5d49b2b7-20250915"
1953919543
};
1954019544
internals.overrideHookState = overrideHookState;
1954119545
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19569,7 +19573,7 @@ __DEV__ &&
1956919573
exports.Shape = Shape;
1957019574
exports.Surface = Surface;
1957119575
exports.Text = Text;
19572-
exports.version = "19.2.0-www-modern-ae22247d-20250915";
19576+
exports.version = "19.2.0-www-modern-5d49b2b7-20250915";
1957319577
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1957419578
"function" ===
1957519579
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)