Skip to content

Commit cfa201d

Browse files
committed
[bug] Fix component name for Portal and add tests (#32640)
Based off: #32499 While looking into `React.lazy` issues for built-ins, I noticed we already error for `lazy` with build-ins, but we don't have any tests for `getComponentNameFromType` using all the built-ins. This may be something we should handle, but for now we should at least have tests. Here's why: while writing tests, I noticed we check `type` instead of `$$typeof` for portals: https://github.com/facebook/react/blob/9cdf8a99edcfd94d7420835ea663edca04237527/packages/react-reconciler/src/ReactPortal.js#L25-L32 This PR adds tests for all the built-ins and fixes the portal bug. [Commit to review](e068c16) DiffTrain build for [8243f3f](8243f3f)
1 parent 58d48f5 commit cfa201d

25 files changed

+124
-124
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.1.0-native-fb-df319522-20250317
1+
19.1.0-native-fb-8243f3f0-20250317

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<530e268e728404a683fd87672b34f066>>
10+
* @generated SignedSource<<f8ce8de0b084a8efc31accbdc12604ab>>
1111
*/
1212

1313
"use strict";
@@ -404,5 +404,5 @@ __DEV__ &&
404404
exports.useFormStatus = function () {
405405
return resolveDispatcher().useHostTransitionStatus();
406406
};
407-
exports.version = "19.1.0-native-fb-df319522-20250317";
407+
exports.version = "19.1.0-native-fb-8243f3f0-20250317";
408408
})();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<4ae1e6711230d98e6b7c0852a1cc3f1a>>
10+
* @generated SignedSource<<ac382a6115fdf1bd38887ad91578ee8a>>
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-df319522-20250317";
206+
exports.version = "19.1.0-native-fb-8243f3f0-20250317";

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<4ae1e6711230d98e6b7c0852a1cc3f1a>>
10+
* @generated SignedSource<<ac382a6115fdf1bd38887ad91578ee8a>>
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-df319522-20250317";
206+
exports.version = "19.1.0-native-fb-8243f3f0-20250317";

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<5cbf73034c600e4183bc13cf66c09320>>
10+
* @generated SignedSource<<663164b56b1bfac8c57fc9650c84f83e>>
1111
*/
1212

1313
/*
@@ -252,8 +252,6 @@ __DEV__ &&
252252
switch (type) {
253253
case REACT_FRAGMENT_TYPE:
254254
return "Fragment";
255-
case REACT_PORTAL_TYPE:
256-
return "Portal";
257255
case REACT_PROFILER_TYPE:
258256
return "Profiler";
259257
case REACT_STRICT_MODE_TYPE:
@@ -273,6 +271,8 @@ __DEV__ &&
273271
),
274272
type.$$typeof)
275273
) {
274+
case REACT_PORTAL_TYPE:
275+
return "Portal";
276276
case REACT_CONTEXT_TYPE:
277277
return (type.displayName || "Context") + ".Provider";
278278
case REACT_CONSUMER_TYPE:
@@ -26052,11 +26052,11 @@ __DEV__ &&
2605226052
};
2605326053
(function () {
2605426054
var isomorphicReactPackageVersion = React.version;
26055-
if ("19.1.0-native-fb-df319522-20250317" !== isomorphicReactPackageVersion)
26055+
if ("19.1.0-native-fb-8243f3f0-20250317" !== isomorphicReactPackageVersion)
2605626056
throw Error(
2605726057
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2605826058
(isomorphicReactPackageVersion +
26059-
"\n - react-dom: 19.1.0-native-fb-df319522-20250317\nLearn more: https://react.dev/warnings/version-mismatch")
26059+
"\n - react-dom: 19.1.0-native-fb-8243f3f0-20250317\nLearn more: https://react.dev/warnings/version-mismatch")
2606026060
);
2606126061
})();
2606226062
("function" === typeof Map &&
@@ -26093,10 +26093,10 @@ __DEV__ &&
2609326093
!(function () {
2609426094
var internals = {
2609526095
bundleType: 1,
26096-
version: "19.1.0-native-fb-df319522-20250317",
26096+
version: "19.1.0-native-fb-8243f3f0-20250317",
2609726097
rendererPackageName: "react-dom",
2609826098
currentDispatcherRef: ReactSharedInternals,
26099-
reconcilerVersion: "19.1.0-native-fb-df319522-20250317"
26099+
reconcilerVersion: "19.1.0-native-fb-8243f3f0-20250317"
2610026100
};
2610126101
internals.overrideHookState = overrideHookState;
2610226102
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -26240,5 +26240,5 @@ __DEV__ &&
2624026240
listenToAllSupportedEvents(container);
2624126241
return new ReactDOMHydrationRoot(initialChildren);
2624226242
};
26243-
exports.version = "19.1.0-native-fb-df319522-20250317";
26243+
exports.version = "19.1.0-native-fb-8243f3f0-20250317";
2624426244
})();

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<5cfd38a22ea972456d6d30ab4b9fd888>>
10+
* @generated SignedSource<<a4ac7bf972b44a1ff467f78bff589a27>>
1111
*/
1212

1313
/*
@@ -196,8 +196,6 @@ function getComponentNameFromType(type) {
196196
switch (type) {
197197
case REACT_FRAGMENT_TYPE:
198198
return "Fragment";
199-
case REACT_PORTAL_TYPE:
200-
return "Portal";
201199
case REACT_PROFILER_TYPE:
202200
return "Profiler";
203201
case REACT_STRICT_MODE_TYPE:
@@ -211,6 +209,8 @@ function getComponentNameFromType(type) {
211209
}
212210
if ("object" === typeof type)
213211
switch (type.$$typeof) {
212+
case REACT_PORTAL_TYPE:
213+
return "Portal";
214214
case REACT_CONTEXT_TYPE:
215215
return (type.displayName || "Context") + ".Provider";
216216
case REACT_CONSUMER_TYPE:
@@ -16153,14 +16153,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1615316153
};
1615416154
var isomorphicReactPackageVersion$jscomp$inline_1833 = React.version;
1615516155
if (
16156-
"19.1.0-native-fb-df319522-20250317" !==
16156+
"19.1.0-native-fb-8243f3f0-20250317" !==
1615716157
isomorphicReactPackageVersion$jscomp$inline_1833
1615816158
)
1615916159
throw Error(
1616016160
formatProdErrorMessage(
1616116161
527,
1616216162
isomorphicReactPackageVersion$jscomp$inline_1833,
16163-
"19.1.0-native-fb-df319522-20250317"
16163+
"19.1.0-native-fb-8243f3f0-20250317"
1616416164
)
1616516165
);
1616616166
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16182,10 +16182,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1618216182
};
1618316183
var internals$jscomp$inline_2295 = {
1618416184
bundleType: 0,
16185-
version: "19.1.0-native-fb-df319522-20250317",
16185+
version: "19.1.0-native-fb-8243f3f0-20250317",
1618616186
rendererPackageName: "react-dom",
1618716187
currentDispatcherRef: ReactSharedInternals,
16188-
reconcilerVersion: "19.1.0-native-fb-df319522-20250317"
16188+
reconcilerVersion: "19.1.0-native-fb-8243f3f0-20250317"
1618916189
};
1619016190
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1619116191
var hook$jscomp$inline_2296 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16289,4 +16289,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1628916289
listenToAllSupportedEvents(container);
1629016290
return new ReactDOMHydrationRoot(initialChildren);
1629116291
};
16292-
exports.version = "19.1.0-native-fb-df319522-20250317";
16292+
exports.version = "19.1.0-native-fb-8243f3f0-20250317";

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<dc6d3b8ce7abd9db1a6d1a9b020118a0>>
10+
* @generated SignedSource<<0336eadfdd6ca2ff219e76b1b7f7fc45>>
1111
*/
1212

1313
/*
@@ -196,8 +196,6 @@ function getComponentNameFromType(type) {
196196
switch (type) {
197197
case REACT_FRAGMENT_TYPE:
198198
return "Fragment";
199-
case REACT_PORTAL_TYPE:
200-
return "Portal";
201199
case REACT_PROFILER_TYPE:
202200
return "Profiler";
203201
case REACT_STRICT_MODE_TYPE:
@@ -211,6 +209,8 @@ function getComponentNameFromType(type) {
211209
}
212210
if ("object" === typeof type)
213211
switch (type.$$typeof) {
212+
case REACT_PORTAL_TYPE:
213+
return "Portal";
214214
case REACT_CONTEXT_TYPE:
215215
return (type.displayName || "Context") + ".Provider";
216216
case REACT_CONSUMER_TYPE:
@@ -16803,14 +16803,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1680316803
};
1680416804
var isomorphicReactPackageVersion$jscomp$inline_1928 = React.version;
1680516805
if (
16806-
"19.1.0-native-fb-df319522-20250317" !==
16806+
"19.1.0-native-fb-8243f3f0-20250317" !==
1680716807
isomorphicReactPackageVersion$jscomp$inline_1928
1680816808
)
1680916809
throw Error(
1681016810
formatProdErrorMessage(
1681116811
527,
1681216812
isomorphicReactPackageVersion$jscomp$inline_1928,
16813-
"19.1.0-native-fb-df319522-20250317"
16813+
"19.1.0-native-fb-8243f3f0-20250317"
1681416814
)
1681516815
);
1681616816
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16832,10 +16832,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1683216832
};
1683316833
var internals$jscomp$inline_1935 = {
1683416834
bundleType: 0,
16835-
version: "19.1.0-native-fb-df319522-20250317",
16835+
version: "19.1.0-native-fb-8243f3f0-20250317",
1683616836
rendererPackageName: "react-dom",
1683716837
currentDispatcherRef: ReactSharedInternals,
16838-
reconcilerVersion: "19.1.0-native-fb-df319522-20250317",
16838+
reconcilerVersion: "19.1.0-native-fb-8243f3f0-20250317",
1683916839
getLaneLabelMap: function () {
1684016840
for (
1684116841
var map = new Map(), lane = 1, index$295 = 0;
@@ -16954,4 +16954,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1695416954
listenToAllSupportedEvents(container);
1695516955
return new ReactDOMHydrationRoot(initialChildren);
1695616956
};
16957-
exports.version = "19.1.0-native-fb-df319522-20250317";
16957+
exports.version = "19.1.0-native-fb-8243f3f0-20250317";

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<880766a0a78549f55208b9d2e4f3f20b>>
10+
* @generated SignedSource<<6ca8a532ae77486e54d92dff8d1369bf>>
1111
*/
1212

1313
/*
@@ -252,8 +252,6 @@ __DEV__ &&
252252
switch (type) {
253253
case REACT_FRAGMENT_TYPE:
254254
return "Fragment";
255-
case REACT_PORTAL_TYPE:
256-
return "Portal";
257255
case REACT_PROFILER_TYPE:
258256
return "Profiler";
259257
case REACT_STRICT_MODE_TYPE:
@@ -273,6 +271,8 @@ __DEV__ &&
273271
),
274272
type.$$typeof)
275273
) {
274+
case REACT_PORTAL_TYPE:
275+
return "Portal";
276276
case REACT_CONTEXT_TYPE:
277277
return (type.displayName || "Context") + ".Provider";
278278
case REACT_CONSUMER_TYPE:
@@ -26113,11 +26113,11 @@ __DEV__ &&
2611326113
};
2611426114
(function () {
2611526115
var isomorphicReactPackageVersion = React.version;
26116-
if ("19.1.0-native-fb-df319522-20250317" !== isomorphicReactPackageVersion)
26116+
if ("19.1.0-native-fb-8243f3f0-20250317" !== isomorphicReactPackageVersion)
2611726117
throw Error(
2611826118
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2611926119
(isomorphicReactPackageVersion +
26120-
"\n - react-dom: 19.1.0-native-fb-df319522-20250317\nLearn more: https://react.dev/warnings/version-mismatch")
26120+
"\n - react-dom: 19.1.0-native-fb-8243f3f0-20250317\nLearn more: https://react.dev/warnings/version-mismatch")
2612126121
);
2612226122
})();
2612326123
("function" === typeof Map &&
@@ -26154,10 +26154,10 @@ __DEV__ &&
2615426154
!(function () {
2615526155
var internals = {
2615626156
bundleType: 1,
26157-
version: "19.1.0-native-fb-df319522-20250317",
26157+
version: "19.1.0-native-fb-8243f3f0-20250317",
2615826158
rendererPackageName: "react-dom",
2615926159
currentDispatcherRef: ReactSharedInternals,
26160-
reconcilerVersion: "19.1.0-native-fb-df319522-20250317"
26160+
reconcilerVersion: "19.1.0-native-fb-8243f3f0-20250317"
2616126161
};
2616226162
internals.overrideHookState = overrideHookState;
2616326163
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -26617,7 +26617,7 @@ __DEV__ &&
2661726617
exports.useFormStatus = function () {
2661826618
return resolveDispatcher().useHostTransitionStatus();
2661926619
};
26620-
exports.version = "19.1.0-native-fb-df319522-20250317";
26620+
exports.version = "19.1.0-native-fb-8243f3f0-20250317";
2662126621
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2662226622
"function" ===
2662326623
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<a0ae271817a1fbd2e88405e23a3f2b77>>
10+
* @generated SignedSource<<b2cc2a5dfc94c2b5ec3ccbd3a0deed2f>>
1111
*/
1212

1313
/*
@@ -196,8 +196,6 @@ function getComponentNameFromType(type) {
196196
switch (type) {
197197
case REACT_FRAGMENT_TYPE:
198198
return "Fragment";
199-
case REACT_PORTAL_TYPE:
200-
return "Portal";
201199
case REACT_PROFILER_TYPE:
202200
return "Profiler";
203201
case REACT_STRICT_MODE_TYPE:
@@ -211,6 +209,8 @@ function getComponentNameFromType(type) {
211209
}
212210
if ("object" === typeof type)
213211
switch (type.$$typeof) {
212+
case REACT_PORTAL_TYPE:
213+
return "Portal";
214214
case REACT_CONTEXT_TYPE:
215215
return (type.displayName || "Context") + ".Provider";
216216
case REACT_CONSUMER_TYPE:
@@ -16164,14 +16164,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1616416164
};
1616516165
var isomorphicReactPackageVersion$jscomp$inline_1834 = React.version;
1616616166
if (
16167-
"19.1.0-native-fb-df319522-20250317" !==
16167+
"19.1.0-native-fb-8243f3f0-20250317" !==
1616816168
isomorphicReactPackageVersion$jscomp$inline_1834
1616916169
)
1617016170
throw Error(
1617116171
formatProdErrorMessage(
1617216172
527,
1617316173
isomorphicReactPackageVersion$jscomp$inline_1834,
16174-
"19.1.0-native-fb-df319522-20250317"
16174+
"19.1.0-native-fb-8243f3f0-20250317"
1617516175
)
1617616176
);
1617716177
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -16193,10 +16193,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1619316193
};
1619416194
var internals$jscomp$inline_2298 = {
1619516195
bundleType: 0,
16196-
version: "19.1.0-native-fb-df319522-20250317",
16196+
version: "19.1.0-native-fb-8243f3f0-20250317",
1619716197
rendererPackageName: "react-dom",
1619816198
currentDispatcherRef: ReactSharedInternals,
16199-
reconcilerVersion: "19.1.0-native-fb-df319522-20250317"
16199+
reconcilerVersion: "19.1.0-native-fb-8243f3f0-20250317"
1620016200
};
1620116201
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1620216202
var hook$jscomp$inline_2299 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16454,4 +16454,4 @@ exports.useFormState = function (action, initialState, permalink) {
1645416454
exports.useFormStatus = function () {
1645516455
return ReactSharedInternals.H.useHostTransitionStatus();
1645616456
};
16457-
exports.version = "19.1.0-native-fb-df319522-20250317";
16457+
exports.version = "19.1.0-native-fb-8243f3f0-20250317";

0 commit comments

Comments
 (0)