Skip to content

Commit

Permalink
Register Suspense retry handlers in commit phase (#31667)
Browse files Browse the repository at this point in the history
To avoid GC pressure and accidentally hanging onto old trees Suspense
boundary retries are now implemented in the commit phase. I used the
Callback flag which was previously only used to schedule callbacks for
Class components. This isn't quite semantically equivalent but it's
unused and seemingly compatible.

DiffTrain build for [de68d2f](de68d2f)
  • Loading branch information
gnoff committed Dec 4, 2024
1 parent 8834a5b commit e3aab58
Show file tree
Hide file tree
Showing 34 changed files with 1,222 additions and 1,120 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16d2bbbd1f1617d636ea0fd271b902a12a763c27
de68d2f4a2403ad1ef46a3036ddc1f9080640588
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16d2bbbd1f1617d636ea0fd271b902a12a763c27
de68d2f4a2403ad1ef46a3036ddc1f9080640588
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-classic-16d2bbbd-20241203";
exports.version = "19.0.0-www-classic-de68d2f4-20241204";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-modern-16d2bbbd-20241203";
exports.version = "19.0.0-www-modern-de68d2f4-20241204";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,4 +634,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-16d2bbbd-20241203";
exports.version = "19.0.0-www-classic-de68d2f4-20241204";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,4 +634,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-16d2bbbd-20241203";
exports.version = "19.0.0-www-modern-de68d2f4-20241204";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-16d2bbbd-20241203";
exports.version = "19.0.0-www-classic-de68d2f4-20241204";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-16d2bbbd-20241203";
exports.version = "19.0.0-www-modern-de68d2f4-20241204";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
16 changes: 10 additions & 6 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -7446,10 +7446,8 @@ __DEV__ &&
);
} else
isSuspenseInstancePending()
? ((workInProgress.flags |= 128),
? ((workInProgress.flags |= 192),
(workInProgress.child = current.child),
retryDehydratedSuspenseBoundary.bind(null, current),
registerSuspenseInstanceRetry(),
(workInProgress = null))
: ((workInProgress = mountSuspensePrimaryChildren(
workInProgress,
Expand Down Expand Up @@ -10535,6 +10533,12 @@ __DEV__ &&
break;
case 13:
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
flags & 64 &&
((finishedRoot = finishedWork.memoizedState),
null !== finishedRoot &&
null !== finishedRoot.dehydrated &&
(retryDehydratedSuspenseBoundary.bind(null, finishedWork),
registerSuspenseInstanceRetry()));
break;
case 22:
prevProps =
Expand Down Expand Up @@ -17125,11 +17129,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-classic-16d2bbbd-20241203",
version: "19.0.0-www-classic-de68d2f4-20241204",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-16d2bbbd-20241203"
reconcilerVersion: "19.0.0-www-classic-de68d2f4-20241204"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -17163,7 +17167,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-classic-16d2bbbd-20241203";
exports.version = "19.0.0-www-classic-de68d2f4-20241204";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
16 changes: 10 additions & 6 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -7263,10 +7263,8 @@ __DEV__ &&
);
} else
isSuspenseInstancePending()
? ((workInProgress.flags |= 128),
? ((workInProgress.flags |= 192),
(workInProgress.child = current.child),
retryDehydratedSuspenseBoundary.bind(null, current),
registerSuspenseInstanceRetry(),
(workInProgress = null))
: ((workInProgress = mountSuspensePrimaryChildren(
workInProgress,
Expand Down Expand Up @@ -10339,6 +10337,12 @@ __DEV__ &&
break;
case 13:
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
flags & 64 &&
((finishedRoot = finishedWork.memoizedState),
null !== finishedRoot &&
null !== finishedRoot.dehydrated &&
(retryDehydratedSuspenseBoundary.bind(null, finishedWork),
registerSuspenseInstanceRetry()));
break;
case 22:
prevProps =
Expand Down Expand Up @@ -16888,11 +16892,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-modern-16d2bbbd-20241203",
version: "19.0.0-www-modern-de68d2f4-20241204",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-www-modern-16d2bbbd-20241203"
reconcilerVersion: "19.0.0-www-modern-de68d2f4-20241204"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -16926,7 +16930,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-modern-16d2bbbd-20241203";
exports.version = "19.0.0-www-modern-de68d2f4-20241204";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
15 changes: 9 additions & 6 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -5332,10 +5332,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
);
} else
shim$2()
? ((workInProgress.flags |= 128),
? ((workInProgress.flags |= 192),
(workInProgress.child = current.child),
retryDehydratedSuspenseBoundary.bind(null, current),
shim$2(),
(workInProgress = null))
: ((workInProgress = mountSuspensePrimaryChildren(
workInProgress,
Expand Down Expand Up @@ -7518,6 +7516,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) {
break;
case 13:
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
flags & 64 &&
((flags = finishedWork.memoizedState),
null !== flags &&
null !== flags.dehydrated &&
(retryDehydratedSuspenseBoundary.bind(null, finishedWork), shim$2()));
break;
case 22:
prevProps =
Expand Down Expand Up @@ -10824,13 +10827,13 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1509 = {
bundleType: 0,
version: "19.0.0-www-classic-16d2bbbd-20241203",
version: "19.0.0-www-classic-de68d2f4-20241204",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function () {
return null;
},
reconcilerVersion: "19.0.0-www-classic-16d2bbbd-20241203"
reconcilerVersion: "19.0.0-www-classic-de68d2f4-20241204"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1510 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10856,4 +10859,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-classic-16d2bbbd-20241203";
exports.version = "19.0.0-www-classic-de68d2f4-20241204";
15 changes: 9 additions & 6 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -5118,10 +5118,8 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
);
} else
shim$2()
? ((workInProgress.flags |= 128),
? ((workInProgress.flags |= 192),
(workInProgress.child = current.child),
retryDehydratedSuspenseBoundary.bind(null, current),
shim$2(),
(workInProgress = null))
: ((workInProgress = mountSuspensePrimaryChildren(
workInProgress,
Expand Down Expand Up @@ -7278,6 +7276,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) {
break;
case 13:
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
flags & 64 &&
((flags = finishedWork.memoizedState),
null !== flags &&
null !== flags.dehydrated &&
(retryDehydratedSuspenseBoundary.bind(null, finishedWork), shim$2()));
break;
case 22:
prevProps =
Expand Down Expand Up @@ -10540,13 +10543,13 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1488 = {
bundleType: 0,
version: "19.0.0-www-modern-16d2bbbd-20241203",
version: "19.0.0-www-modern-de68d2f4-20241204",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function () {
return null;
},
reconcilerVersion: "19.0.0-www-modern-16d2bbbd-20241203"
reconcilerVersion: "19.0.0-www-modern-de68d2f4-20241204"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1489 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10572,4 +10575,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-modern-16d2bbbd-20241203";
exports.version = "19.0.0-www-modern-de68d2f4-20241204";
Loading

0 comments on commit e3aab58

Please sign in to comment.