Skip to content

Commit cf42336

Browse files
committed
[Fiber] Adjust the suspensey image/css timeout based on already elapsed time (#34478)
Currently suspensey images doesn't account for how long we've already been waiting. This means that you can for example wait for 300ms for the throttle + 500ms for the images. If a Transition takes a while to complete you can also wait that time + an additional 500ms for the images. This tracks the start time of a Transition so that we can count the timeout starting from when the user interacted or when the last fallback committed (which is where the 300ms throttle is computed from). Creating a single timeline. This also moves the timeout to a central place which I'll use in a follow up. DiffTrain build for [e3f1918](e3f1918)
1 parent 93e989a commit cf42336

34 files changed

+1356
-966
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e12b0bdc3b976cc2431ccf30126cf339be83720c
1+
e3f191803cbe53df360b32f6735b05bb969c55cf
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e12b0bdc3b976cc2431ccf30126cf339be83720c
1+
e3f191803cbe53df360b32f6735b05bb969c55cf

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-e12b0bdc-20250915";
1422+
exports.version = "19.2.0-www-classic-e3f19180-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-e12b0bdc-20250915";
1422+
exports.version = "19.2.0-www-modern-e3f19180-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-e12b0bdc-20250915";
605+
exports.version = "19.2.0-www-classic-e3f19180-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-e12b0bdc-20250915";
605+
exports.version = "19.2.0-www-modern-e3f19180-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-e12b0bdc-20250915";
609+
exports.version = "19.2.0-www-classic-e3f19180-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-e12b0bdc-20250915";
609+
exports.version = "19.2.0-www-modern-e3f19180-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: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14943,7 +14943,12 @@ __DEV__ &&
1494314943
16785408 === (didSkipSuspendedSiblings & 16785408)
1494414944
)
1494514945
(appearingViewTransitions = null),
14946-
accumulateSuspenseyCommitOnFiber(finishedWork);
14946+
accumulateSuspenseyCommitOnFiber(finishedWork),
14947+
(lanes & 62914560) === lanes
14948+
? globalMostRecentFallbackTime - now$1()
14949+
: (lanes & 4194048) === lanes
14950+
? globalMostRecentTransitionTime - now$1()
14951+
: 0;
1494714952
commitRoot(
1494814953
root,
1494914954
finishedWork,
@@ -17835,6 +17840,7 @@ __DEV__ &&
1783517840
needsIsomorphicIndicator = !1,
1783617841
prevOnStartTransitionFinish = ReactSharedInternals.S;
1783717842
ReactSharedInternals.S = function (transition, returnValue) {
17843+
globalMostRecentTransitionTime = now$1();
1783817844
if (
1783917845
"object" === typeof returnValue &&
1784017846
null !== returnValue &&
@@ -19485,6 +19491,7 @@ __DEV__ &&
1948519491
workInProgressRootDidIncludeRecursiveRenderUpdate = !1,
1948619492
didIncludeCommitPhaseUpdate = !1,
1948719493
globalMostRecentFallbackTime = 0,
19494+
globalMostRecentTransitionTime = 0,
1948819495
FALLBACK_THROTTLE_MS = 300,
1948919496
workInProgressRootRenderTargetTime = Infinity,
1949019497
RENDER_TIMEOUT_MS = 500,
@@ -19754,10 +19761,10 @@ __DEV__ &&
1975419761
(function () {
1975519762
var internals = {
1975619763
bundleType: 1,
19757-
version: "19.2.0-www-classic-e12b0bdc-20250915",
19764+
version: "19.2.0-www-classic-e3f19180-20250915",
1975819765
rendererPackageName: "react-art",
1975919766
currentDispatcherRef: ReactSharedInternals,
19760-
reconcilerVersion: "19.2.0-www-classic-e12b0bdc-20250915"
19767+
reconcilerVersion: "19.2.0-www-classic-e3f19180-20250915"
1976119768
};
1976219769
internals.overrideHookState = overrideHookState;
1976319770
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19791,7 +19798,7 @@ __DEV__ &&
1979119798
exports.Shape = Shape;
1979219799
exports.Surface = Surface;
1979319800
exports.Text = Text;
19794-
exports.version = "19.2.0-www-classic-e12b0bdc-20250915";
19801+
exports.version = "19.2.0-www-classic-e3f19180-20250915";
1979519802
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1979619803
"function" ===
1979719804
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14761,7 +14761,12 @@ __DEV__ &&
1476114761
16785408 === (didSkipSuspendedSiblings & 16785408)
1476214762
)
1476314763
(appearingViewTransitions = null),
14764-
accumulateSuspenseyCommitOnFiber(finishedWork);
14764+
accumulateSuspenseyCommitOnFiber(finishedWork),
14765+
(lanes & 62914560) === lanes
14766+
? globalMostRecentFallbackTime - now$1()
14767+
: (lanes & 4194048) === lanes
14768+
? globalMostRecentTransitionTime - now$1()
14769+
: 0;
1476514770
commitRoot(
1476614771
root,
1476714772
finishedWork,
@@ -17607,6 +17612,7 @@ __DEV__ &&
1760717612
needsIsomorphicIndicator = !1,
1760817613
prevOnStartTransitionFinish = ReactSharedInternals.S;
1760917614
ReactSharedInternals.S = function (transition, returnValue) {
17615+
globalMostRecentTransitionTime = now$1();
1761017616
if (
1761117617
"object" === typeof returnValue &&
1761217618
null !== returnValue &&
@@ -19256,6 +19262,7 @@ __DEV__ &&
1925619262
workInProgressRootDidIncludeRecursiveRenderUpdate = !1,
1925719263
didIncludeCommitPhaseUpdate = !1,
1925819264
globalMostRecentFallbackTime = 0,
19265+
globalMostRecentTransitionTime = 0,
1925919266
FALLBACK_THROTTLE_MS = 300,
1926019267
workInProgressRootRenderTargetTime = Infinity,
1926119268
RENDER_TIMEOUT_MS = 500,
@@ -19525,10 +19532,10 @@ __DEV__ &&
1952519532
(function () {
1952619533
var internals = {
1952719534
bundleType: 1,
19528-
version: "19.2.0-www-modern-e12b0bdc-20250915",
19535+
version: "19.2.0-www-modern-e3f19180-20250915",
1952919536
rendererPackageName: "react-art",
1953019537
currentDispatcherRef: ReactSharedInternals,
19531-
reconcilerVersion: "19.2.0-www-modern-e12b0bdc-20250915"
19538+
reconcilerVersion: "19.2.0-www-modern-e3f19180-20250915"
1953219539
};
1953319540
internals.overrideHookState = overrideHookState;
1953419541
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19562,7 +19569,7 @@ __DEV__ &&
1956219569
exports.Shape = Shape;
1956319570
exports.Surface = Surface;
1956419571
exports.Text = Text;
19565-
exports.version = "19.2.0-www-modern-e12b0bdc-20250915";
19572+
exports.version = "19.2.0-www-modern-e3f19180-20250915";
1956619573
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1956719574
"function" ===
1956819575
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)