Skip to content

Commit

Permalink
Reconciler: Combine identical cases in findParent (#32210)
Browse files Browse the repository at this point in the history
## Summary

When lookup `Parent`, `HostRoot` and `HostPortal` should be merged,
because when creating a `Portal`, it will also include
`containerInfo`(So we can directly use this `containerInfo` to delete
the real DOM nodes.), so there is no need to handle them separately.

## How did you test this change?

No behavior changes, all existing tests pass.

DiffTrain build for [19ca800](19ca800)
  • Loading branch information
gnoff committed Jan 31, 2025
1 parent ade1b63 commit 582a010
Show file tree
Hide file tree
Showing 34 changed files with 86 additions and 146 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9ff42a8798863c995523e284142b47e3cdfaee80
19ca800caa01eec2f5e65e547c67b11592bec8b0
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9ff42a8798863c995523e284142b47e3cdfaee80
19ca800caa01eec2f5e65e547c67b11592bec8b0
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 @@ -1958,7 +1958,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.1.0-www-classic-9ff42a87-20250130";
exports.version = "19.1.0-www-classic-19ca800c-20250131";
"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 @@ -1958,7 +1958,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.1.0-www-modern-9ff42a87-20250130";
exports.version = "19.1.0-www-modern-19ca800c-20250131";
"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 @@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-classic-9ff42a87-20250130";
exports.version = "19.1.0-www-classic-19ca800c-20250131";
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 @@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-modern-9ff42a87-20250130";
exports.version = "19.1.0-www-modern-19ca800c-20250131";
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 @@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-classic-9ff42a87-20250130";
exports.version = "19.1.0-www-classic-19ca800c-20250131";
"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 @@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-modern-9ff42a87-20250130";
exports.version = "19.1.0-www-modern-19ca800c-20250131";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
9 changes: 3 additions & 6 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10917,9 +10917,6 @@ __DEV__ &&
hostParentIsContainer = !1;
break a;
case 3:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
break a;
case 4:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
Expand Down Expand Up @@ -16935,10 +16932,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-classic-9ff42a87-20250130",
version: "19.1.0-www-classic-19ca800c-20250131",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-9ff42a87-20250130"
reconcilerVersion: "19.1.0-www-classic-19ca800c-20250131"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -16972,7 +16969,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-classic-9ff42a87-20250130";
exports.version = "19.1.0-www-classic-19ca800c-20250131";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
9 changes: 3 additions & 6 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -10735,9 +10735,6 @@ __DEV__ &&
hostParentIsContainer = !1;
break a;
case 3:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
break a;
case 4:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
Expand Down Expand Up @@ -16707,10 +16704,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-modern-9ff42a87-20250130",
version: "19.1.0-www-modern-19ca800c-20250131",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-9ff42a87-20250130"
reconcilerVersion: "19.1.0-www-modern-19ca800c-20250131"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -16744,7 +16741,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-modern-9ff42a87-20250130";
exports.version = "19.1.0-www-modern-19ca800c-20250131";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
9 changes: 3 additions & 6 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -7883,9 +7883,6 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) {
hostParentIsContainer = !1;
break a;
case 3:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
break a;
case 4:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
Expand Down Expand Up @@ -10816,10 +10813,10 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1512 = {
bundleType: 0,
version: "19.1.0-www-classic-9ff42a87-20250130",
version: "19.1.0-www-classic-19ca800c-20250131",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-9ff42a87-20250130"
reconcilerVersion: "19.1.0-www-classic-19ca800c-20250131"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1513 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10845,4 +10842,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-classic-9ff42a87-20250130";
exports.version = "19.1.0-www-classic-19ca800c-20250131";
9 changes: 3 additions & 6 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -7642,9 +7642,6 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) {
hostParentIsContainer = !1;
break a;
case 3:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
break a;
case 4:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
Expand Down Expand Up @@ -10536,10 +10533,10 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1485 = {
bundleType: 0,
version: "19.1.0-www-modern-9ff42a87-20250130",
version: "19.1.0-www-modern-19ca800c-20250131",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-9ff42a87-20250130"
reconcilerVersion: "19.1.0-www-modern-19ca800c-20250131"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1486 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10565,4 +10562,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-modern-9ff42a87-20250130";
exports.version = "19.1.0-www-modern-19ca800c-20250131";
13 changes: 5 additions & 8 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -13901,9 +13901,6 @@ __DEV__ &&
hostParentIsContainer = !1;
break a;
case 3:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
break a;
case 4:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
Expand Down Expand Up @@ -27478,11 +27475,11 @@ __DEV__ &&
return_targetInst = null;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.1.0-www-classic-9ff42a87-20250130" !== isomorphicReactPackageVersion)
if ("19.1.0-www-classic-19ca800c-20250131" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.1.0-www-classic-9ff42a87-20250130\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.1.0-www-classic-19ca800c-20250131\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -27525,10 +27522,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-classic-9ff42a87-20250130",
version: "19.1.0-www-classic-19ca800c-20250131",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-9ff42a87-20250130"
reconcilerVersion: "19.1.0-www-classic-19ca800c-20250131"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -28126,7 +28123,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.1.0-www-classic-9ff42a87-20250130";
exports.version = "19.1.0-www-classic-19ca800c-20250131";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
13 changes: 5 additions & 8 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -13700,9 +13700,6 @@ __DEV__ &&
hostParentIsContainer = !1;
break a;
case 3:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
break a;
case 4:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
Expand Down Expand Up @@ -27264,11 +27261,11 @@ __DEV__ &&
return_targetInst = null;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.1.0-www-modern-9ff42a87-20250130" !== isomorphicReactPackageVersion)
if ("19.1.0-www-modern-19ca800c-20250131" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.1.0-www-modern-9ff42a87-20250130\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.1.0-www-modern-19ca800c-20250131\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -27311,10 +27308,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-modern-9ff42a87-20250130",
version: "19.1.0-www-modern-19ca800c-20250131",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-9ff42a87-20250130"
reconcilerVersion: "19.1.0-www-modern-19ca800c-20250131"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -27912,7 +27909,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.1.0-www-modern-9ff42a87-20250130";
exports.version = "19.1.0-www-modern-19ca800c-20250131";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
13 changes: 5 additions & 8 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9564,9 +9564,6 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) {
hostParentIsContainer = !1;
break a;
case 3:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
break a;
case 4:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
Expand Down Expand Up @@ -17346,14 +17343,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1799 = React.version;
if (
"19.1.0-www-classic-9ff42a87-20250130" !==
"19.1.0-www-classic-19ca800c-20250131" !==
isomorphicReactPackageVersion$jscomp$inline_1799
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1799,
"19.1.0-www-classic-9ff42a87-20250130"
"19.1.0-www-classic-19ca800c-20250131"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -17371,10 +17368,10 @@ Internals.Events = [
];
var internals$jscomp$inline_2330 = {
bundleType: 0,
version: "19.1.0-www-classic-9ff42a87-20250130",
version: "19.1.0-www-classic-19ca800c-20250131",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-9ff42a87-20250130"
reconcilerVersion: "19.1.0-www-classic-19ca800c-20250131"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2331 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17738,4 +17735,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-www-classic-9ff42a87-20250130";
exports.version = "19.1.0-www-classic-19ca800c-20250131";
13 changes: 5 additions & 8 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9315,9 +9315,6 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) {
hostParentIsContainer = !1;
break a;
case 3:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
break a;
case 4:
hostParent = parent.stateNode.containerInfo;
hostParentIsContainer = !0;
Expand Down Expand Up @@ -17082,14 +17079,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1789 = React.version;
if (
"19.1.0-www-modern-9ff42a87-20250130" !==
"19.1.0-www-modern-19ca800c-20250131" !==
isomorphicReactPackageVersion$jscomp$inline_1789
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1789,
"19.1.0-www-modern-9ff42a87-20250130"
"19.1.0-www-modern-19ca800c-20250131"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -17107,10 +17104,10 @@ Internals.Events = [
];
var internals$jscomp$inline_2312 = {
bundleType: 0,
version: "19.1.0-www-modern-9ff42a87-20250130",
version: "19.1.0-www-modern-19ca800c-20250131",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-9ff42a87-20250130"
reconcilerVersion: "19.1.0-www-modern-19ca800c-20250131"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2313 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17474,4 +17471,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-www-modern-9ff42a87-20250130";
exports.version = "19.1.0-www-modern-19ca800c-20250131";
Loading

0 comments on commit 582a010

Please sign in to comment.