Skip to content

Commit 2ca4fae

Browse files
committed
[Fiber] getHoistableRoot() should account for Document containers (#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)
1 parent 9f6cb64 commit 2ca4fae

23 files changed

+104
-92
lines changed

compiled-rn/VERSION_NATIVE_FB

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.1.0-native-fb-ff628334-20250205
1+
19.1.0-native-fb-b48e7399-20250206

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<cbd289e323f7a8415dbd55fd449a4cb3>>
10+
* @generated SignedSource<<62f7075a95158f271aa4bcfd217c458e>>
1111
*/
1212

1313
"use strict";
@@ -428,5 +428,5 @@ __DEV__ &&
428428
exports.useFormStatus = function () {
429429
return resolveDispatcher().useHostTransitionStatus();
430430
};
431-
exports.version = "19.1.0-native-fb-ff628334-20250205";
431+
exports.version = "19.1.0-native-fb-b48e7399-20250206";
432432
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<76039a6de37b6ad225a095a4d8a23b62>>
10+
* @generated SignedSource<<f9d4e77e757ae66cbcb1d7414f754042>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.1.0-native-fb-ff628334-20250205";
206+
exports.version = "19.1.0-native-fb-b48e7399-20250206";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<76039a6de37b6ad225a095a4d8a23b62>>
10+
* @generated SignedSource<<f9d4e77e757ae66cbcb1d7414f754042>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.1.0-native-fb-ff628334-20250205";
206+
exports.version = "19.1.0-native-fb-b48e7399-20250206";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<53f2738f295e889392402f62bb65d4fb>>
10+
* @generated SignedSource<<0210959d65b7dd74eefb8e2616b5eecc>>
1111
*/
1212

1313
/*
@@ -20709,7 +20709,9 @@ __DEV__ &&
2070920709
function getHoistableRoot(container) {
2071020710
return "function" === typeof container.getRootNode
2071120711
? container.getRootNode()
20712-
: container.ownerDocument;
20712+
: 9 === container.nodeType
20713+
? container
20714+
: container.ownerDocument;
2071320715
}
2071420716
function preconnectAs(rel, href, crossOrigin) {
2071520717
var ownerDocument = globalDocument;
@@ -26003,11 +26005,11 @@ __DEV__ &&
2600326005
};
2600426006
(function () {
2600526007
var isomorphicReactPackageVersion = React.version;
26006-
if ("19.1.0-native-fb-ff628334-20250205" !== isomorphicReactPackageVersion)
26008+
if ("19.1.0-native-fb-b48e7399-20250206" !== isomorphicReactPackageVersion)
2600726009
throw Error(
2600826010
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2600926011
(isomorphicReactPackageVersion +
26010-
"\n - react-dom: 19.1.0-native-fb-ff628334-20250205\nLearn more: https://react.dev/warnings/version-mismatch")
26012+
"\n - react-dom: 19.1.0-native-fb-b48e7399-20250206\nLearn more: https://react.dev/warnings/version-mismatch")
2601126013
);
2601226014
})();
2601326015
("function" === typeof Map &&
@@ -26044,10 +26046,10 @@ __DEV__ &&
2604426046
!(function () {
2604526047
var internals = {
2604626048
bundleType: 1,
26047-
version: "19.1.0-native-fb-ff628334-20250205",
26049+
version: "19.1.0-native-fb-b48e7399-20250206",
2604826050
rendererPackageName: "react-dom",
2604926051
currentDispatcherRef: ReactSharedInternals,
26050-
reconcilerVersion: "19.1.0-native-fb-ff628334-20250205"
26052+
reconcilerVersion: "19.1.0-native-fb-b48e7399-20250206"
2605126053
};
2605226054
internals.overrideHookState = overrideHookState;
2605326055
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -26191,5 +26193,5 @@ __DEV__ &&
2619126193
listenToAllSupportedEvents(container);
2619226194
return new ReactDOMHydrationRoot(initialChildren);
2619326195
};
26194-
exports.version = "19.1.0-native-fb-ff628334-20250205";
26196+
exports.version = "19.1.0-native-fb-b48e7399-20250206";
2619526197
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<9aa58e05a9a44a6e0c497301edb51fd9>>
10+
* @generated SignedSource<<5f0cfb6e40046900dc3eced0829c002e>>
1111
*/
1212

1313
/*
@@ -14499,7 +14499,9 @@ var preloadPropsMap = new Map(),
1449914499
function getHoistableRoot(container) {
1450014500
return "function" === typeof container.getRootNode
1450114501
? container.getRootNode()
14502-
: container.ownerDocument;
14502+
: 9 === container.nodeType
14503+
? container
14504+
: container.ownerDocument;
1450314505
}
1450414506
var previousDispatcher = ReactDOMSharedInternals.d;
1450514507
ReactDOMSharedInternals.d = {
@@ -16016,14 +16018,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1601616018
};
1601716019
var isomorphicReactPackageVersion$jscomp$inline_1802 = React.version;
1601816020
if (
16019-
"19.1.0-native-fb-ff628334-20250205" !==
16021+
"19.1.0-native-fb-b48e7399-20250206" !==
1602016022
isomorphicReactPackageVersion$jscomp$inline_1802
1602116023
)
1602216024
throw Error(
1602316025
formatProdErrorMessage(
1602416026
527,
1602516027
isomorphicReactPackageVersion$jscomp$inline_1802,
16026-
"19.1.0-native-fb-ff628334-20250205"
16028+
"19.1.0-native-fb-b48e7399-20250206"
1602716029
)
1602816030
);
1602916031
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16045,10 +16047,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1604516047
};
1604616048
var internals$jscomp$inline_2262 = {
1604716049
bundleType: 0,
16048-
version: "19.1.0-native-fb-ff628334-20250205",
16050+
version: "19.1.0-native-fb-b48e7399-20250206",
1604916051
rendererPackageName: "react-dom",
1605016052
currentDispatcherRef: ReactSharedInternals,
16051-
reconcilerVersion: "19.1.0-native-fb-ff628334-20250205"
16053+
reconcilerVersion: "19.1.0-native-fb-b48e7399-20250206"
1605216054
};
1605316055
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1605416056
var hook$jscomp$inline_2263 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16152,4 +16154,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1615216154
listenToAllSupportedEvents(container);
1615316155
return new ReactDOMHydrationRoot(initialChildren);
1615416156
};
16155-
exports.version = "19.1.0-native-fb-ff628334-20250205";
16157+
exports.version = "19.1.0-native-fb-b48e7399-20250206";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<59e5ad0acce0802c9e75da9cd92ab1f3>>
10+
* @generated SignedSource<<7b93297b0f45500f277a91a830b00250>>
1111
*/
1212

1313
/*
@@ -15140,7 +15140,9 @@ var preloadPropsMap = new Map(),
1514015140
function getHoistableRoot(container) {
1514115141
return "function" === typeof container.getRootNode
1514215142
? container.getRootNode()
15143-
: container.ownerDocument;
15143+
: 9 === container.nodeType
15144+
? container
15145+
: container.ownerDocument;
1514415146
}
1514515147
var previousDispatcher = ReactDOMSharedInternals.d;
1514615148
ReactDOMSharedInternals.d = {
@@ -16665,14 +16667,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1666516667
};
1666616668
var isomorphicReactPackageVersion$jscomp$inline_1897 = React.version;
1666716669
if (
16668-
"19.1.0-native-fb-ff628334-20250205" !==
16670+
"19.1.0-native-fb-b48e7399-20250206" !==
1666916671
isomorphicReactPackageVersion$jscomp$inline_1897
1667016672
)
1667116673
throw Error(
1667216674
formatProdErrorMessage(
1667316675
527,
1667416676
isomorphicReactPackageVersion$jscomp$inline_1897,
16675-
"19.1.0-native-fb-ff628334-20250205"
16677+
"19.1.0-native-fb-b48e7399-20250206"
1667616678
)
1667716679
);
1667816680
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16694,10 +16696,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1669416696
};
1669516697
var internals$jscomp$inline_1904 = {
1669616698
bundleType: 0,
16697-
version: "19.1.0-native-fb-ff628334-20250205",
16699+
version: "19.1.0-native-fb-b48e7399-20250206",
1669816700
rendererPackageName: "react-dom",
1669916701
currentDispatcherRef: ReactSharedInternals,
16700-
reconcilerVersion: "19.1.0-native-fb-ff628334-20250205",
16702+
reconcilerVersion: "19.1.0-native-fb-b48e7399-20250206",
1670116703
getLaneLabelMap: function () {
1670216704
for (
1670316705
var map = new Map(), lane = 1, index$294 = 0;
@@ -16816,4 +16818,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1681616818
listenToAllSupportedEvents(container);
1681716819
return new ReactDOMHydrationRoot(initialChildren);
1681816820
};
16819-
exports.version = "19.1.0-native-fb-ff628334-20250205";
16821+
exports.version = "19.1.0-native-fb-b48e7399-20250206";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<5164734a56abefd6fcd812a8342c804d>>
10+
* @generated SignedSource<<2513cf260af6ca46f66ecb657d7b2901>>
1111
*/
1212

1313
/*
@@ -20721,7 +20721,9 @@ __DEV__ &&
2072120721
function getHoistableRoot(container) {
2072220722
return "function" === typeof container.getRootNode
2072320723
? container.getRootNode()
20724-
: container.ownerDocument;
20724+
: 9 === container.nodeType
20725+
? container
20726+
: container.ownerDocument;
2072520727
}
2072620728
function preconnectAs(rel, href, crossOrigin) {
2072720729
var ownerDocument = globalDocument;
@@ -26064,11 +26066,11 @@ __DEV__ &&
2606426066
};
2606526067
(function () {
2606626068
var isomorphicReactPackageVersion = React.version;
26067-
if ("19.1.0-native-fb-ff628334-20250205" !== isomorphicReactPackageVersion)
26069+
if ("19.1.0-native-fb-b48e7399-20250206" !== isomorphicReactPackageVersion)
2606826070
throw Error(
2606926071
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2607026072
(isomorphicReactPackageVersion +
26071-
"\n - react-dom: 19.1.0-native-fb-ff628334-20250205\nLearn more: https://react.dev/warnings/version-mismatch")
26073+
"\n - react-dom: 19.1.0-native-fb-b48e7399-20250206\nLearn more: https://react.dev/warnings/version-mismatch")
2607226074
);
2607326075
})();
2607426076
("function" === typeof Map &&
@@ -26105,10 +26107,10 @@ __DEV__ &&
2610526107
!(function () {
2610626108
var internals = {
2610726109
bundleType: 1,
26108-
version: "19.1.0-native-fb-ff628334-20250205",
26110+
version: "19.1.0-native-fb-b48e7399-20250206",
2610926111
rendererPackageName: "react-dom",
2611026112
currentDispatcherRef: ReactSharedInternals,
26111-
reconcilerVersion: "19.1.0-native-fb-ff628334-20250205"
26113+
reconcilerVersion: "19.1.0-native-fb-b48e7399-20250206"
2611226114
};
2611326115
internals.overrideHookState = overrideHookState;
2611426116
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -26568,7 +26570,7 @@ __DEV__ &&
2656826570
exports.useFormStatus = function () {
2656926571
return resolveDispatcher().useHostTransitionStatus();
2657026572
};
26571-
exports.version = "19.1.0-native-fb-ff628334-20250205";
26573+
exports.version = "19.1.0-native-fb-b48e7399-20250206";
2657226574
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2657326575
"function" ===
2657426576
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<4ee844129940b1cdacc992f796eb5e29>>
10+
* @generated SignedSource<<2a0a722d7897c658cc3a6e00d5471de5>>
1111
*/
1212

1313
/*
@@ -14499,7 +14499,9 @@ var preloadPropsMap = new Map(),
1449914499
function getHoistableRoot(container) {
1450014500
return "function" === typeof container.getRootNode
1450114501
? container.getRootNode()
14502-
: container.ownerDocument;
14502+
: 9 === container.nodeType
14503+
? container
14504+
: container.ownerDocument;
1450314505
}
1450414506
var previousDispatcher = ReactDOMSharedInternals.d;
1450514507
ReactDOMSharedInternals.d = {
@@ -16027,14 +16029,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1602716029
};
1602816030
var isomorphicReactPackageVersion$jscomp$inline_1803 = React.version;
1602916031
if (
16030-
"19.1.0-native-fb-ff628334-20250205" !==
16032+
"19.1.0-native-fb-b48e7399-20250206" !==
1603116033
isomorphicReactPackageVersion$jscomp$inline_1803
1603216034
)
1603316035
throw Error(
1603416036
formatProdErrorMessage(
1603516037
527,
1603616038
isomorphicReactPackageVersion$jscomp$inline_1803,
16037-
"19.1.0-native-fb-ff628334-20250205"
16039+
"19.1.0-native-fb-b48e7399-20250206"
1603816040
)
1603916041
);
1604016042
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16056,10 +16058,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1605616058
};
1605716059
var internals$jscomp$inline_2265 = {
1605816060
bundleType: 0,
16059-
version: "19.1.0-native-fb-ff628334-20250205",
16061+
version: "19.1.0-native-fb-b48e7399-20250206",
1606016062
rendererPackageName: "react-dom",
1606116063
currentDispatcherRef: ReactSharedInternals,
16062-
reconcilerVersion: "19.1.0-native-fb-ff628334-20250205"
16064+
reconcilerVersion: "19.1.0-native-fb-b48e7399-20250206"
1606316065
};
1606416066
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1606516067
var hook$jscomp$inline_2266 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16317,4 +16319,4 @@ exports.useFormState = function (action, initialState, permalink) {
1631716319
exports.useFormStatus = function () {
1631816320
return ReactSharedInternals.H.useHostTransitionStatus();
1631916321
};
16320-
exports.version = "19.1.0-native-fb-ff628334-20250205";
16322+
exports.version = "19.1.0-native-fb-b48e7399-20250206";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<f1827a84106b8091079e4998b550636c>>
10+
* @generated SignedSource<<7a906fbdbe281c084654742edb2693dc>>
1111
*/
1212

1313
/*
@@ -15144,7 +15144,9 @@ var preloadPropsMap = new Map(),
1514415144
function getHoistableRoot(container) {
1514515145
return "function" === typeof container.getRootNode
1514615146
? container.getRootNode()
15147-
: container.ownerDocument;
15147+
: 9 === container.nodeType
15148+
? container
15149+
: container.ownerDocument;
1514815150
}
1514915151
var previousDispatcher = ReactDOMSharedInternals.d;
1515015152
ReactDOMSharedInternals.d = {
@@ -16680,14 +16682,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1668016682
};
1668116683
var isomorphicReactPackageVersion$jscomp$inline_1898 = React.version;
1668216684
if (
16683-
"19.1.0-native-fb-ff628334-20250205" !==
16685+
"19.1.0-native-fb-b48e7399-20250206" !==
1668416686
isomorphicReactPackageVersion$jscomp$inline_1898
1668516687
)
1668616688
throw Error(
1668716689
formatProdErrorMessage(
1668816690
527,
1668916691
isomorphicReactPackageVersion$jscomp$inline_1898,
16690-
"19.1.0-native-fb-ff628334-20250205"
16692+
"19.1.0-native-fb-b48e7399-20250206"
1669116693
)
1669216694
);
1669316695
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16709,10 +16711,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1670916711
};
1671016712
var internals$jscomp$inline_1905 = {
1671116713
bundleType: 0,
16712-
version: "19.1.0-native-fb-ff628334-20250205",
16714+
version: "19.1.0-native-fb-b48e7399-20250206",
1671316715
rendererPackageName: "react-dom",
1671416716
currentDispatcherRef: ReactSharedInternals,
16715-
reconcilerVersion: "19.1.0-native-fb-ff628334-20250205",
16717+
reconcilerVersion: "19.1.0-native-fb-b48e7399-20250206",
1671616718
getLaneLabelMap: function () {
1671716719
for (
1671816720
var map = new Map(), lane = 1, index$294 = 0;
@@ -16985,7 +16987,7 @@ exports.useFormState = function (action, initialState, permalink) {
1698516987
exports.useFormStatus = function () {
1698616988
return ReactSharedInternals.H.useHostTransitionStatus();
1698716989
};
16988-
exports.version = "19.1.0-native-fb-ff628334-20250205";
16990+
exports.version = "19.1.0-native-fb-b48e7399-20250206";
1698916991
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1699016992
"function" ===
1699116993
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)