Skip to content

Commit

Permalink
Remove vestigial Suspense batching logic (#25861)
Browse files Browse the repository at this point in the history
This code was originally added in the old ExpirationTime implementation
of Suspense. The idea is that if multiple updates suspend inside the
same Suspense boundary, and both of them resolve, we should render both
results in the same batch, to reduce jank.

This was an incomplete idea, though. We later discovered a stronger
requirement — once we show a fallback, we cannot fill in that fallback
without completing _all_ the updates that were previously skipped over.
Otherwise you get tearing. This was fixed by #18411, then we discovered
additional related flaws that were addressed in #24685. See those PR
descriptions for additional context.

So I believe this older code is no longer necessary.

DiffTrain build for [48274a4](48274a4)
[View git log for this commit](https://github.com/facebook/react/commits/48274a43aa708f63a7580142a4c1c1a47f31c1ac)
  • Loading branch information
acdlite committed Jan 4, 2023
1 parent f96c1b8 commit f71e333
Show file tree
Hide file tree
Showing 28 changed files with 166 additions and 326 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
@@ -1 +1 @@
de7d1c90718ea8f4844a2219991f7115ef2bd2c5
48274a43aa708f63a7580142a4c1c1a47f31c1ac
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
@@ -1 +1 @@
de7d1c90718ea8f4844a2219991f7115ef2bd2c5
48274a43aa708f63a7580142a4c1c1a47f31c1ac
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.classic.js
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-classic-de7d1c907-20221223";
var ReactVersion = "18.3.0-www-classic-48274a43a-20230104";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-modern-de7d1c907-20221223";
var ReactVersion = "18.3.0-www-modern-48274a43a-20230104";

// ATTENTION
// When adding new symbols to this file,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Expand Up @@ -643,4 +643,4 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-classic-de7d1c907-20221223";
exports.version = "18.3.0-www-classic-48274a43a-20230104";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Expand Up @@ -635,4 +635,4 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-modern-de7d1c907-20221223";
exports.version = "18.3.0-www-modern-48274a43a-20230104";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Expand Up @@ -654,7 +654,7 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-classic-de7d1c907-20221223";
exports.version = "18.3.0-www-classic-48274a43a-20230104";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Expand Up @@ -646,7 +646,7 @@ exports.useSyncExternalStore = function(
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-modern-de7d1c907-20221223";
exports.version = "18.3.0-www-modern-48274a43a-20230104";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
14 changes: 1 addition & 13 deletions compiled/facebook-www/ReactART-dev.classic.js
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-classic-de7d1c907-20221223";
var ReactVersion = "18.3.0-www-classic-48274a43a-20230104";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -23840,18 +23840,6 @@ function finishConcurrentRender(root, exitStatus, lanes) {
if (nextLanes !== NoLanes) {
// There's additional work on this root.
break;
}

var suspendedLanes = root.suspendedLanes;

if (!isSubsetOfLanes(suspendedLanes, lanes)) {
// We should prefer to render the fallback of at the last
// suspended level. Ping the last suspended level to try
// rendering it again.
// FIXME: What if the suspended lanes are Idle? Should not restart.
var eventTime = requestEventTime();
markRootPinged(root, suspendedLanes);
break;
} // The render is suspended, it hasn't timed out, and there's no
// lower priority work to do. Instead of committing the fallback
// immediately, wait for more data to arrive.
Expand Down
14 changes: 1 addition & 13 deletions compiled/facebook-www/ReactART-dev.modern.js
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-modern-de7d1c907-20221223";
var ReactVersion = "18.3.0-www-modern-48274a43a-20230104";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -23529,18 +23529,6 @@ function finishConcurrentRender(root, exitStatus, lanes) {
if (nextLanes !== NoLanes) {
// There's additional work on this root.
break;
}

var suspendedLanes = root.suspendedLanes;

if (!isSubsetOfLanes(suspendedLanes, lanes)) {
// We should prefer to render the fallback of at the last
// suspended level. Ping the last suspended level to try
// rendering it again.
// FIXME: What if the suspended lanes are Idle? Should not restart.
var eventTime = requestEventTime();
markRootPinged(root, suspendedLanes);
break;
} // The render is suspended, it hasn't timed out, and there's no
// lower priority work to do. Instead of committing the fallback
// immediately, wait for more data to arrive.
Expand Down
42 changes: 17 additions & 25 deletions compiled/facebook-www/ReactART-prod.classic.js
Expand Up @@ -7923,25 +7923,17 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
markRootSuspended$1(root, lanes);
if (
(lanes & 125829120) === lanes &&
((didTimeout = globalMostRecentFallbackTime + 500 - now()),
10 < didTimeout)
((lanes = globalMostRecentFallbackTime + 500 - now()), 10 < lanes)
) {
if (0 !== getNextLanes(root, 0)) break;
originallyAttemptedLanes = root.suspendedLanes;
if ((originallyAttemptedLanes & lanes) !== lanes) {
requestEventTime();
root.pingedLanes |=
root.suspendedLanes & originallyAttemptedLanes;
break;
}
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(
null,
root,
workInProgressRootRecoverableErrors,
workInProgressTransitions
),
didTimeout
lanes
);
break;
}
Expand Down Expand Up @@ -9822,19 +9814,19 @@ var slice = Array.prototype.slice,
};
return Text;
})(React.Component),
devToolsConfig$jscomp$inline_1165 = {
devToolsConfig$jscomp$inline_1167 = {
findFiberByHostInstance: function() {
return null;
},
bundleType: 0,
version: "18.3.0-www-classic-de7d1c907-20221223",
version: "18.3.0-www-classic-48274a43a-20230104",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1338 = {
bundleType: devToolsConfig$jscomp$inline_1165.bundleType,
version: devToolsConfig$jscomp$inline_1165.version,
rendererPackageName: devToolsConfig$jscomp$inline_1165.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1165.rendererConfig,
var internals$jscomp$inline_1334 = {
bundleType: devToolsConfig$jscomp$inline_1167.bundleType,
version: devToolsConfig$jscomp$inline_1167.version,
rendererPackageName: devToolsConfig$jscomp$inline_1167.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1167.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -9851,26 +9843,26 @@ var internals$jscomp$inline_1338 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1165.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1167.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-de7d1c907-20221223"
reconcilerVersion: "18.3.0-next-48274a43a-20230104"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1339 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1335 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1339.isDisabled &&
hook$jscomp$inline_1339.supportsFiber
!hook$jscomp$inline_1335.isDisabled &&
hook$jscomp$inline_1335.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1339.inject(
internals$jscomp$inline_1338
(rendererID = hook$jscomp$inline_1335.inject(
internals$jscomp$inline_1334
)),
(injectedHook = hook$jscomp$inline_1339);
(injectedHook = hook$jscomp$inline_1335);
} catch (err) {}
}
var Path = Mode$1.Path;
Expand Down
42 changes: 17 additions & 25 deletions compiled/facebook-www/ReactART-prod.modern.js
Expand Up @@ -7657,25 +7657,17 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
markRootSuspended$1(root, lanes);
if (
(lanes & 125829120) === lanes &&
((didTimeout = globalMostRecentFallbackTime + 500 - now()),
10 < didTimeout)
((lanes = globalMostRecentFallbackTime + 500 - now()), 10 < lanes)
) {
if (0 !== getNextLanes(root, 0)) break;
originallyAttemptedLanes = root.suspendedLanes;
if ((originallyAttemptedLanes & lanes) !== lanes) {
requestEventTime();
root.pingedLanes |=
root.suspendedLanes & originallyAttemptedLanes;
break;
}
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(
null,
root,
workInProgressRootRecoverableErrors,
workInProgressTransitions
),
didTimeout
lanes
);
break;
}
Expand Down Expand Up @@ -9489,19 +9481,19 @@ var slice = Array.prototype.slice,
};
return Text;
})(React.Component),
devToolsConfig$jscomp$inline_1154 = {
devToolsConfig$jscomp$inline_1156 = {
findFiberByHostInstance: function() {
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-de7d1c907-20221223",
version: "18.3.0-www-modern-48274a43a-20230104",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1329 = {
bundleType: devToolsConfig$jscomp$inline_1154.bundleType,
version: devToolsConfig$jscomp$inline_1154.version,
rendererPackageName: devToolsConfig$jscomp$inline_1154.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1154.rendererConfig,
var internals$jscomp$inline_1325 = {
bundleType: devToolsConfig$jscomp$inline_1156.bundleType,
version: devToolsConfig$jscomp$inline_1156.version,
rendererPackageName: devToolsConfig$jscomp$inline_1156.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1156.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -9518,26 +9510,26 @@ var internals$jscomp$inline_1329 = {
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1154.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1156.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-de7d1c907-20221223"
reconcilerVersion: "18.3.0-next-48274a43a-20230104"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1330 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1326 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1330.isDisabled &&
hook$jscomp$inline_1330.supportsFiber
!hook$jscomp$inline_1326.isDisabled &&
hook$jscomp$inline_1326.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1330.inject(
internals$jscomp$inline_1329
(rendererID = hook$jscomp$inline_1326.inject(
internals$jscomp$inline_1325
)),
(injectedHook = hook$jscomp$inline_1330);
(injectedHook = hook$jscomp$inline_1326);
} catch (err) {}
}
var Path = Mode$1.Path;
Expand Down
14 changes: 1 addition & 13 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Expand Up @@ -38776,18 +38776,6 @@ function finishConcurrentRender(root, exitStatus, lanes) {
if (nextLanes !== NoLanes) {
// There's additional work on this root.
break;
}

var suspendedLanes = root.suspendedLanes;

if (!isSubsetOfLanes(suspendedLanes, lanes)) {
// We should prefer to render the fallback of at the last
// suspended level. Ping the last suspended level to try
// rendering it again.
// FIXME: What if the suspended lanes are Idle? Should not restart.
var eventTime = requestEventTime();
markRootPinged(root, suspendedLanes);
break;
} // The render is suspended, it hasn't timed out, and there's no
// lower priority work to do. Instead of committing the fallback
// immediately, wait for more data to arrive.
Expand Down Expand Up @@ -42647,7 +42635,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-de7d1c907-20221223";
var ReactVersion = "18.3.0-www-classic-48274a43a-20230104";

function createPortal(
children,
Expand Down
14 changes: 1 addition & 13 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Expand Up @@ -38500,18 +38500,6 @@ function finishConcurrentRender(root, exitStatus, lanes) {
if (nextLanes !== NoLanes) {
// There's additional work on this root.
break;
}

var suspendedLanes = root.suspendedLanes;

if (!isSubsetOfLanes(suspendedLanes, lanes)) {
// We should prefer to render the fallback of at the last
// suspended level. Ping the last suspended level to try
// rendering it again.
// FIXME: What if the suspended lanes are Idle? Should not restart.
var eventTime = requestEventTime();
markRootPinged(root, suspendedLanes);
break;
} // The render is suspended, it hasn't timed out, and there's no
// lower priority work to do. Instead of committing the fallback
// immediately, wait for more data to arrive.
Expand Down Expand Up @@ -42371,7 +42359,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-de7d1c907-20221223";
var ReactVersion = "18.3.0-www-modern-48274a43a-20230104";

function createPortal(
children,
Expand Down

0 comments on commit f71e333

Please sign in to comment.