Skip to content

Commit

Permalink
[Fiber] getHoistableRoot() should account for Document containers (#…
Browse files Browse the repository at this point in the history
…32321)

While modern DOM implementations all support getRootNode if you are
running React in a runtime which does not the fallback logic which uses
`.ownerDocument` works everywhere except when the container is a
Document itself. This change corrects this by returning the container
intsance if it is a Document type.

DiffTrain build for [b48e739](b48e739)
  • Loading branch information
gnoff committed Feb 6, 2025
1 parent 02b8f6c commit 6d25b6a
Show file tree
Hide file tree
Showing 34 changed files with 116 additions and 96 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ff6283340a10bb72ad0fb16ca027606a9ea1e67c
b48e739998432fc9672a42d0d04515980b8cae82
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ff6283340a10bb72ad0fb16ca027606a9ea1e67c
b48e739998432fc9672a42d0d04515980b8cae82
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 @@ -1972,7 +1972,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.1.0-www-classic-ff628334-20250205";
exports.version = "19.1.0-www-classic-b48e7399-20250206";
"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 @@ -1972,7 +1972,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.1.0-www-modern-ff628334-20250205";
exports.version = "19.1.0-www-modern-b48e7399-20250206";
"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 @@ -639,4 +639,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-classic-ff628334-20250205";
exports.version = "19.1.0-www-classic-b48e7399-20250206";
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 @@ -639,4 +639,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-modern-ff628334-20250205";
exports.version = "19.1.0-www-modern-b48e7399-20250206";
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 @@ -643,7 +643,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-classic-ff628334-20250205";
exports.version = "19.1.0-www-classic-b48e7399-20250206";
"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 @@ -643,7 +643,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.1.0-www-modern-ff628334-20250205";
exports.version = "19.1.0-www-modern-b48e7399-20250206";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17417,10 +17417,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-classic-ff628334-20250205",
version: "19.1.0-www-classic-b48e7399-20250206",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-ff628334-20250205"
reconcilerVersion: "19.1.0-www-classic-b48e7399-20250206"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -17454,7 +17454,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-classic-ff628334-20250205";
exports.version = "19.1.0-www-classic-b48e7399-20250206";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -17189,10 +17189,10 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-modern-ff628334-20250205",
version: "19.1.0-www-modern-b48e7399-20250206",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-ff628334-20250205"
reconcilerVersion: "19.1.0-www-modern-b48e7399-20250206"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -17226,7 +17226,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-modern-ff628334-20250205";
exports.version = "19.1.0-www-modern-b48e7399-20250206";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -11275,10 +11275,10 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1567 = {
bundleType: 0,
version: "19.1.0-www-classic-ff628334-20250205",
version: "19.1.0-www-classic-b48e7399-20250206",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-ff628334-20250205"
reconcilerVersion: "19.1.0-www-classic-b48e7399-20250206"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1568 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -11304,4 +11304,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-classic-ff628334-20250205";
exports.version = "19.1.0-www-classic-b48e7399-20250206";
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -10990,10 +10990,10 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1540 = {
bundleType: 0,
version: "19.1.0-www-modern-ff628334-20250205",
version: "19.1.0-www-modern-b48e7399-20250206",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-ff628334-20250205"
reconcilerVersion: "19.1.0-www-modern-b48e7399-20250206"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1541 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -11019,4 +11019,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.1.0-www-modern-ff628334-20250205";
exports.version = "19.1.0-www-modern-b48e7399-20250206";
14 changes: 8 additions & 6 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -23301,7 +23301,9 @@ __DEV__ &&
function getHoistableRoot(container) {
return "function" === typeof container.getRootNode
? container.getRootNode()
: container.ownerDocument;
: container.nodeType === DOCUMENT_NODE
? container
: container.ownerDocument;
}
function preconnectAs(rel, href, crossOrigin) {
var ownerDocument = globalDocument;
Expand Down Expand Up @@ -28615,11 +28617,11 @@ __DEV__ &&
return_targetInst = null;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.1.0-www-classic-ff628334-20250205" !== isomorphicReactPackageVersion)
if ("19.1.0-www-classic-b48e7399-20250206" !== 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-ff628334-20250205\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.1.0-www-classic-b48e7399-20250206\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -28662,10 +28664,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-classic-ff628334-20250205",
version: "19.1.0-www-classic-b48e7399-20250206",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-ff628334-20250205"
reconcilerVersion: "19.1.0-www-classic-b48e7399-20250206"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -29263,7 +29265,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.1.0-www-classic-ff628334-20250205";
exports.version = "19.1.0-www-classic-b48e7399-20250206";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
14 changes: 8 additions & 6 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -23095,7 +23095,9 @@ __DEV__ &&
function getHoistableRoot(container) {
return "function" === typeof container.getRootNode
? container.getRootNode()
: container.ownerDocument;
: container.nodeType === DOCUMENT_NODE
? container
: container.ownerDocument;
}
function preconnectAs(rel, href, crossOrigin) {
var ownerDocument = globalDocument;
Expand Down Expand Up @@ -28401,11 +28403,11 @@ __DEV__ &&
return_targetInst = null;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.1.0-www-modern-ff628334-20250205" !== isomorphicReactPackageVersion)
if ("19.1.0-www-modern-b48e7399-20250206" !== 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-ff628334-20250205\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.1.0-www-modern-b48e7399-20250206\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -28448,10 +28450,10 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.1.0-www-modern-ff628334-20250205",
version: "19.1.0-www-modern-b48e7399-20250206",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-ff628334-20250205"
reconcilerVersion: "19.1.0-www-modern-b48e7399-20250206"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -29049,7 +29051,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.1.0-www-modern-ff628334-20250205";
exports.version = "19.1.0-www-modern-b48e7399-20250206";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
14 changes: 8 additions & 6 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -16963,7 +16963,9 @@ var preloadPropsMap = new Map(),
function getHoistableRoot(container) {
return "function" === typeof container.getRootNode
? container.getRootNode()
: container.ownerDocument;
: 9 === container.nodeType
? container
: container.ownerDocument;
}
var previousDispatcher = Internals.d;
Internals.d = {
Expand Down Expand Up @@ -18440,14 +18442,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1871 = React.version;
if (
"19.1.0-www-classic-ff628334-20250205" !==
"19.1.0-www-classic-b48e7399-20250206" !==
isomorphicReactPackageVersion$jscomp$inline_1871
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1871,
"19.1.0-www-classic-ff628334-20250205"
"19.1.0-www-classic-b48e7399-20250206"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -18465,10 +18467,10 @@ Internals.Events = [
];
var internals$jscomp$inline_2431 = {
bundleType: 0,
version: "19.1.0-www-classic-ff628334-20250205",
version: "19.1.0-www-classic-b48e7399-20250206",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-ff628334-20250205"
reconcilerVersion: "19.1.0-www-classic-b48e7399-20250206"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2432 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -18832,4 +18834,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-www-classic-ff628334-20250205";
exports.version = "19.1.0-www-classic-b48e7399-20250206";
14 changes: 8 additions & 6 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -16694,7 +16694,9 @@ var preloadPropsMap = new Map(),
function getHoistableRoot(container) {
return "function" === typeof container.getRootNode
? container.getRootNode()
: container.ownerDocument;
: 9 === container.nodeType
? container
: container.ownerDocument;
}
var previousDispatcher = Internals.d;
Internals.d = {
Expand Down Expand Up @@ -18171,14 +18173,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1861 = React.version;
if (
"19.1.0-www-modern-ff628334-20250205" !==
"19.1.0-www-modern-b48e7399-20250206" !==
isomorphicReactPackageVersion$jscomp$inline_1861
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1861,
"19.1.0-www-modern-ff628334-20250205"
"19.1.0-www-modern-b48e7399-20250206"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -18196,10 +18198,10 @@ Internals.Events = [
];
var internals$jscomp$inline_2413 = {
bundleType: 0,
version: "19.1.0-www-modern-ff628334-20250205",
version: "19.1.0-www-modern-b48e7399-20250206",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-modern-ff628334-20250205"
reconcilerVersion: "19.1.0-www-modern-b48e7399-20250206"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2414 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -18563,4 +18565,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-www-modern-ff628334-20250205";
exports.version = "19.1.0-www-modern-b48e7399-20250206";
14 changes: 8 additions & 6 deletions compiled/facebook-www/ReactDOM-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -17654,7 +17654,9 @@ var preloadPropsMap = new Map(),
function getHoistableRoot(container) {
return "function" === typeof container.getRootNode
? container.getRootNode()
: container.ownerDocument;
: 9 === container.nodeType
? container
: container.ownerDocument;
}
var previousDispatcher = Internals.d;
Internals.d = {
Expand Down Expand Up @@ -19131,14 +19133,14 @@ function getCrossOriginStringAs(as, input) {
}
var isomorphicReactPackageVersion$jscomp$inline_1968 = React.version;
if (
"19.1.0-www-classic-ff628334-20250205" !==
"19.1.0-www-classic-b48e7399-20250206" !==
isomorphicReactPackageVersion$jscomp$inline_1968
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1968,
"19.1.0-www-classic-ff628334-20250205"
"19.1.0-www-classic-b48e7399-20250206"
)
);
Internals.findDOMNode = function (componentOrElement) {
Expand All @@ -19156,10 +19158,10 @@ Internals.Events = [
];
var internals$jscomp$inline_1970 = {
bundleType: 0,
version: "19.1.0-www-classic-ff628334-20250205",
version: "19.1.0-www-classic-b48e7399-20250206",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
reconcilerVersion: "19.1.0-www-classic-ff628334-20250205"
reconcilerVersion: "19.1.0-www-classic-b48e7399-20250206"
};
enableSchedulingProfiler &&
((internals$jscomp$inline_1970.getLaneLabelMap = getLaneLabelMap),
Expand Down Expand Up @@ -19526,7 +19528,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.1.0-www-classic-ff628334-20250205";
exports.version = "19.1.0-www-classic-b48e7399-20250206";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Loading

0 comments on commit 6d25b6a

Please sign in to comment.