Skip to content

Commit a28916b

Browse files
committed
Don't flush synchronous work if we're in the middle of a ViewTransition async sequence (#32760)
Starting a View Transition is an async sequence. Since React can get a sync update in the middle of sequence we sometimes interrupt that sequence. Currently, we don't actually cancel the View Transition so it can just run as a partial. This ensures that we fully skip it when that happens, as well as warn. However, it's very easy to trigger this with just a setState in useLayoutEffect right now. Therefore if we're inside the preparing sequence of a startViewTransition, this delays work that would've normally flushed in a microtask. ~Maybe we want to do the same for Default work already scheduled through a scheduler Task.~ Edit: This was already done. `flushSync` currently will still lead to an interrupted View Transition (with a warning). There's a tradeoff here whether we want to try our best to preserve the guarantees of `flushSync` or favor the animation. It's already possible to suspend at the root with `flushSync` which means it's not always 100% guaranteed to commit anyway. We could treat it as suspended. But let's see how much this is a problem in practice. DiffTrain build for [a5297ec](a5297ec)
1 parent 0c4df01 commit a28916b

23 files changed

+121
-101
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.1.0-native-fb-313332d1-20250326
1+
19.1.0-native-fb-a5297ece-20250326

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<59a68a92f9791ad01721c8f35e649a5a>>
10+
* @generated SignedSource<<2f71c1d9e2da2cc0eb3498cd15d64a1a>>
1111
*/
1212

1313
"use strict";
@@ -404,5 +404,5 @@ __DEV__ &&
404404
exports.useFormStatus = function () {
405405
return resolveDispatcher().useHostTransitionStatus();
406406
};
407-
exports.version = "19.1.0-native-fb-313332d1-20250326";
407+
exports.version = "19.1.0-native-fb-a5297ece-20250326";
408408
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<276ed8e797db85285572a1f3d94438cb>>
10+
* @generated SignedSource<<23a11b053da80e4d031b301c2555e701>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.1.0-native-fb-313332d1-20250326";
206+
exports.version = "19.1.0-native-fb-a5297ece-20250326";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<276ed8e797db85285572a1f3d94438cb>>
10+
* @generated SignedSource<<23a11b053da80e4d031b301c2555e701>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.1.0-native-fb-313332d1-20250326";
206+
exports.version = "19.1.0-native-fb-a5297ece-20250326";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<f8526818355cc4e9f972d11736cfabe4>>
10+
* @generated SignedSource<<f9e8c8f2c331a2ae85f3a12ee7ecf32c>>
1111
*/
1212

1313
/*
@@ -16814,7 +16814,9 @@ __DEV__ &&
1681416814
mightHavePendingSyncWork = !0;
1681516815
root = next;
1681616816
}
16817-
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
16817+
(pendingEffectsStatus !== NO_PENDING_EFFECTS &&
16818+
pendingEffectsStatus !== PENDING_PASSIVE_PHASE) ||
16819+
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
1681816820
}
1681916821
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
1682016822
for (
@@ -25656,11 +25658,11 @@ __DEV__ &&
2565625658
};
2565725659
(function () {
2565825660
var isomorphicReactPackageVersion = React.version;
25659-
if ("19.1.0-native-fb-313332d1-20250326" !== isomorphicReactPackageVersion)
25661+
if ("19.1.0-native-fb-a5297ece-20250326" !== isomorphicReactPackageVersion)
2566025662
throw Error(
2566125663
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2566225664
(isomorphicReactPackageVersion +
25663-
"\n - react-dom: 19.1.0-native-fb-313332d1-20250326\nLearn more: https://react.dev/warnings/version-mismatch")
25665+
"\n - react-dom: 19.1.0-native-fb-a5297ece-20250326\nLearn more: https://react.dev/warnings/version-mismatch")
2566425666
);
2566525667
})();
2566625668
("function" === typeof Map &&
@@ -25697,10 +25699,10 @@ __DEV__ &&
2569725699
!(function () {
2569825700
var internals = {
2569925701
bundleType: 1,
25700-
version: "19.1.0-native-fb-313332d1-20250326",
25702+
version: "19.1.0-native-fb-a5297ece-20250326",
2570125703
rendererPackageName: "react-dom",
2570225704
currentDispatcherRef: ReactSharedInternals,
25703-
reconcilerVersion: "19.1.0-native-fb-313332d1-20250326"
25705+
reconcilerVersion: "19.1.0-native-fb-a5297ece-20250326"
2570425706
};
2570525707
internals.overrideHookState = overrideHookState;
2570625708
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -25844,5 +25846,5 @@ __DEV__ &&
2584425846
listenToAllSupportedEvents(container);
2584525847
return new ReactDOMHydrationRoot(initialChildren);
2584625848
};
25847-
exports.version = "19.1.0-native-fb-313332d1-20250326";
25849+
exports.version = "19.1.0-native-fb-a5297ece-20250326";
2584825850
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<eb26b8a58b2e032534559f65172dea8b>>
10+
* @generated SignedSource<<40470992724521cc69353bb35c5a7918>>
1111
*/
1212

1313
/*
@@ -12120,7 +12120,8 @@ function processRootScheduleInMicrotask() {
1212012120
mightHavePendingSyncWork = !0;
1212112121
root = next;
1212212122
}
12123-
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
12123+
(0 !== pendingEffectsStatus && 5 !== pendingEffectsStatus) ||
12124+
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
1212412125
}
1212512126
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
1212612127
for (
@@ -15968,14 +15969,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1596815969
};
1596915970
var isomorphicReactPackageVersion$jscomp$inline_1796 = React.version;
1597015971
if (
15971-
"19.1.0-native-fb-313332d1-20250326" !==
15972+
"19.1.0-native-fb-a5297ece-20250326" !==
1597215973
isomorphicReactPackageVersion$jscomp$inline_1796
1597315974
)
1597415975
throw Error(
1597515976
formatProdErrorMessage(
1597615977
527,
1597715978
isomorphicReactPackageVersion$jscomp$inline_1796,
15978-
"19.1.0-native-fb-313332d1-20250326"
15979+
"19.1.0-native-fb-a5297ece-20250326"
1597915980
)
1598015981
);
1598115982
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -15997,10 +15998,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1599715998
};
1599815999
var internals$jscomp$inline_2246 = {
1599916000
bundleType: 0,
16000-
version: "19.1.0-native-fb-313332d1-20250326",
16001+
version: "19.1.0-native-fb-a5297ece-20250326",
1600116002
rendererPackageName: "react-dom",
1600216003
currentDispatcherRef: ReactSharedInternals,
16003-
reconcilerVersion: "19.1.0-native-fb-313332d1-20250326"
16004+
reconcilerVersion: "19.1.0-native-fb-a5297ece-20250326"
1600416005
};
1600516006
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1600616007
var hook$jscomp$inline_2247 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16104,4 +16105,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1610416105
listenToAllSupportedEvents(container);
1610516106
return new ReactDOMHydrationRoot(initialChildren);
1610616107
};
16107-
exports.version = "19.1.0-native-fb-313332d1-20250326";
16108+
exports.version = "19.1.0-native-fb-a5297ece-20250326";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<08bf8e534293b3d83f7a5f9fe57a58a1>>
10+
* @generated SignedSource<<ed768351e2a7a4ec898f4b41c1d02c80>>
1111
*/
1212

1313
/*
@@ -12757,7 +12757,8 @@ function processRootScheduleInMicrotask() {
1275712757
mightHavePendingSyncWork = !0;
1275812758
root = next;
1275912759
}
12760-
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
12760+
(0 !== pendingEffectsStatus && 5 !== pendingEffectsStatus) ||
12761+
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
1276112762
}
1276212763
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
1276312764
for (
@@ -16616,14 +16617,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1661616617
};
1661716618
var isomorphicReactPackageVersion$jscomp$inline_1891 = React.version;
1661816619
if (
16619-
"19.1.0-native-fb-313332d1-20250326" !==
16620+
"19.1.0-native-fb-a5297ece-20250326" !==
1662016621
isomorphicReactPackageVersion$jscomp$inline_1891
1662116622
)
1662216623
throw Error(
1662316624
formatProdErrorMessage(
1662416625
527,
1662516626
isomorphicReactPackageVersion$jscomp$inline_1891,
16626-
"19.1.0-native-fb-313332d1-20250326"
16627+
"19.1.0-native-fb-a5297ece-20250326"
1662716628
)
1662816629
);
1662916630
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16645,10 +16646,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1664516646
};
1664616647
var internals$jscomp$inline_1898 = {
1664716648
bundleType: 0,
16648-
version: "19.1.0-native-fb-313332d1-20250326",
16649+
version: "19.1.0-native-fb-a5297ece-20250326",
1664916650
rendererPackageName: "react-dom",
1665016651
currentDispatcherRef: ReactSharedInternals,
16651-
reconcilerVersion: "19.1.0-native-fb-313332d1-20250326",
16652+
reconcilerVersion: "19.1.0-native-fb-a5297ece-20250326",
1665216653
getLaneLabelMap: function () {
1665316654
for (
1665416655
var map = new Map(), lane = 1, index$293 = 0;
@@ -16767,4 +16768,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1676716768
listenToAllSupportedEvents(container);
1676816769
return new ReactDOMHydrationRoot(initialChildren);
1676916770
};
16770-
exports.version = "19.1.0-native-fb-313332d1-20250326";
16771+
exports.version = "19.1.0-native-fb-a5297ece-20250326";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<2aa066a7190c889b7163e86e47a2c897>>
10+
* @generated SignedSource<<6f30b0fe89206a9cb9b24e5b1524c625>>
1111
*/
1212

1313
/*
@@ -16826,7 +16826,9 @@ __DEV__ &&
1682616826
mightHavePendingSyncWork = !0;
1682716827
root = next;
1682816828
}
16829-
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
16829+
(pendingEffectsStatus !== NO_PENDING_EFFECTS &&
16830+
pendingEffectsStatus !== PENDING_PASSIVE_PHASE) ||
16831+
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
1683016832
}
1683116833
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
1683216834
for (
@@ -25717,11 +25719,11 @@ __DEV__ &&
2571725719
};
2571825720
(function () {
2571925721
var isomorphicReactPackageVersion = React.version;
25720-
if ("19.1.0-native-fb-313332d1-20250326" !== isomorphicReactPackageVersion)
25722+
if ("19.1.0-native-fb-a5297ece-20250326" !== isomorphicReactPackageVersion)
2572125723
throw Error(
2572225724
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2572325725
(isomorphicReactPackageVersion +
25724-
"\n - react-dom: 19.1.0-native-fb-313332d1-20250326\nLearn more: https://react.dev/warnings/version-mismatch")
25726+
"\n - react-dom: 19.1.0-native-fb-a5297ece-20250326\nLearn more: https://react.dev/warnings/version-mismatch")
2572525727
);
2572625728
})();
2572725729
("function" === typeof Map &&
@@ -25758,10 +25760,10 @@ __DEV__ &&
2575825760
!(function () {
2575925761
var internals = {
2576025762
bundleType: 1,
25761-
version: "19.1.0-native-fb-313332d1-20250326",
25763+
version: "19.1.0-native-fb-a5297ece-20250326",
2576225764
rendererPackageName: "react-dom",
2576325765
currentDispatcherRef: ReactSharedInternals,
25764-
reconcilerVersion: "19.1.0-native-fb-313332d1-20250326"
25766+
reconcilerVersion: "19.1.0-native-fb-a5297ece-20250326"
2576525767
};
2576625768
internals.overrideHookState = overrideHookState;
2576725769
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -26221,7 +26223,7 @@ __DEV__ &&
2622126223
exports.useFormStatus = function () {
2622226224
return resolveDispatcher().useHostTransitionStatus();
2622326225
};
26224-
exports.version = "19.1.0-native-fb-313332d1-20250326";
26226+
exports.version = "19.1.0-native-fb-a5297ece-20250326";
2622526227
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2622626228
"function" ===
2622726229
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<03012d1d5172bc7f325c5db3ff859fe2>>
10+
* @generated SignedSource<<143e56c6d2a27a985995d07b3470a2f9>>
1111
*/
1212

1313
/*
@@ -12120,7 +12120,8 @@ function processRootScheduleInMicrotask() {
1212012120
mightHavePendingSyncWork = !0;
1212112121
root = next;
1212212122
}
12123-
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
12123+
(0 !== pendingEffectsStatus && 5 !== pendingEffectsStatus) ||
12124+
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
1212412125
}
1212512126
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
1212612127
for (
@@ -15979,14 +15980,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1597915980
};
1598015981
var isomorphicReactPackageVersion$jscomp$inline_1797 = React.version;
1598115982
if (
15982-
"19.1.0-native-fb-313332d1-20250326" !==
15983+
"19.1.0-native-fb-a5297ece-20250326" !==
1598315984
isomorphicReactPackageVersion$jscomp$inline_1797
1598415985
)
1598515986
throw Error(
1598615987
formatProdErrorMessage(
1598715988
527,
1598815989
isomorphicReactPackageVersion$jscomp$inline_1797,
15989-
"19.1.0-native-fb-313332d1-20250326"
15990+
"19.1.0-native-fb-a5297ece-20250326"
1599015991
)
1599115992
);
1599215993
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16008,10 +16009,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1600816009
};
1600916010
var internals$jscomp$inline_2249 = {
1601016011
bundleType: 0,
16011-
version: "19.1.0-native-fb-313332d1-20250326",
16012+
version: "19.1.0-native-fb-a5297ece-20250326",
1601216013
rendererPackageName: "react-dom",
1601316014
currentDispatcherRef: ReactSharedInternals,
16014-
reconcilerVersion: "19.1.0-native-fb-313332d1-20250326"
16015+
reconcilerVersion: "19.1.0-native-fb-a5297ece-20250326"
1601516016
};
1601616017
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1601716018
var hook$jscomp$inline_2250 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16269,4 +16270,4 @@ exports.useFormState = function (action, initialState, permalink) {
1626916270
exports.useFormStatus = function () {
1627016271
return ReactSharedInternals.H.useHostTransitionStatus();
1627116272
};
16272-
exports.version = "19.1.0-native-fb-313332d1-20250326";
16273+
exports.version = "19.1.0-native-fb-a5297ece-20250326";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<be54a215e85f9160c4b79c01dfa2b1b1>>
10+
* @generated SignedSource<<4bc94e59836a35eb7b5308c14978d8fd>>
1111
*/
1212

1313
/*
@@ -12761,7 +12761,8 @@ function processRootScheduleInMicrotask() {
1276112761
mightHavePendingSyncWork = !0;
1276212762
root = next;
1276312763
}
12764-
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
12764+
(0 !== pendingEffectsStatus && 5 !== pendingEffectsStatus) ||
12765+
flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1);
1276512766
}
1276612767
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
1276712768
for (
@@ -16631,14 +16632,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1663116632
};
1663216633
var isomorphicReactPackageVersion$jscomp$inline_1892 = React.version;
1663316634
if (
16634-
"19.1.0-native-fb-313332d1-20250326" !==
16635+
"19.1.0-native-fb-a5297ece-20250326" !==
1663516636
isomorphicReactPackageVersion$jscomp$inline_1892
1663616637
)
1663716638
throw Error(
1663816639
formatProdErrorMessage(
1663916640
527,
1664016641
isomorphicReactPackageVersion$jscomp$inline_1892,
16641-
"19.1.0-native-fb-313332d1-20250326"
16642+
"19.1.0-native-fb-a5297ece-20250326"
1664216643
)
1664316644
);
1664416645
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16660,10 +16661,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1666016661
};
1666116662
var internals$jscomp$inline_1899 = {
1666216663
bundleType: 0,
16663-
version: "19.1.0-native-fb-313332d1-20250326",
16664+
version: "19.1.0-native-fb-a5297ece-20250326",
1666416665
rendererPackageName: "react-dom",
1666516666
currentDispatcherRef: ReactSharedInternals,
16666-
reconcilerVersion: "19.1.0-native-fb-313332d1-20250326",
16667+
reconcilerVersion: "19.1.0-native-fb-a5297ece-20250326",
1666716668
getLaneLabelMap: function () {
1666816669
for (
1666916670
var map = new Map(), lane = 1, index$293 = 0;
@@ -16936,7 +16937,7 @@ exports.useFormState = function (action, initialState, permalink) {
1693616937
exports.useFormStatus = function () {
1693716938
return ReactSharedInternals.H.useHostTransitionStatus();
1693816939
};
16939-
exports.version = "19.1.0-native-fb-313332d1-20250326";
16940+
exports.version = "19.1.0-native-fb-a5297ece-20250326";
1694016941
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1694116942
"function" ===
1694216943
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)