Skip to content

Commit 4392bb2

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 0c39221 commit 4392bb2

38 files changed

+146
-146
lines changed

compiled/facebook-www/JSXDEVRuntime-dev.classic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ __DEV__ &&
2323
switch (type) {
2424
case REACT_FRAGMENT_TYPE:
2525
return "Fragment";
26-
case REACT_PORTAL_TYPE:
27-
return "Portal";
2826
case REACT_PROFILER_TYPE:
2927
return "Profiler";
3028
case REACT_STRICT_MODE_TYPE:
@@ -48,6 +46,8 @@ __DEV__ &&
4846
),
4947
type.$$typeof)
5048
) {
49+
case REACT_PORTAL_TYPE:
50+
return "Portal";
5151
case REACT_PROVIDER_TYPE:
5252
if (enableRenderableContext) break;
5353
else return (type._context.displayName || "Context") + ".Provider";

compiled/facebook-www/JSXDEVRuntime-dev.modern.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ __DEV__ &&
2323
switch (type) {
2424
case REACT_FRAGMENT_TYPE:
2525
return "Fragment";
26-
case REACT_PORTAL_TYPE:
27-
return "Portal";
2826
case REACT_PROFILER_TYPE:
2927
return "Profiler";
3028
case REACT_STRICT_MODE_TYPE:
@@ -48,6 +46,8 @@ __DEV__ &&
4846
),
4947
type.$$typeof)
5048
) {
49+
case REACT_PORTAL_TYPE:
50+
return "Portal";
5151
case REACT_PROVIDER_TYPE:
5252
if (enableRenderableContext) break;
5353
else return (type._context.displayName || "Context") + ".Provider";

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
df319522758b7fdfed3ddfa517cc1cc298ef1602
1+
8243f3f0631698e819c690710a7f18f767068981
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
df319522758b7fdfed3ddfa517cc1cc298ef1602
1+
8243f3f0631698e819c690710a7f18f767068981

compiled/facebook-www/React-dev.classic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ __DEV__ &&
9696
switch (type) {
9797
case REACT_FRAGMENT_TYPE:
9898
return "Fragment";
99-
case REACT_PORTAL_TYPE:
100-
return "Portal";
10199
case REACT_PROFILER_TYPE:
102100
return "Profiler";
103101
case REACT_STRICT_MODE_TYPE:
@@ -121,6 +119,8 @@ __DEV__ &&
121119
),
122120
type.$$typeof)
123121
) {
122+
case REACT_PORTAL_TYPE:
123+
return "Portal";
124124
case REACT_PROVIDER_TYPE:
125125
if (enableRenderableContext) break;
126126
else return (type._context.displayName || "Context") + ".Provider";
@@ -1534,7 +1534,7 @@ __DEV__ &&
15341534
exports.useTransition = function () {
15351535
return resolveDispatcher().useTransition();
15361536
};
1537-
exports.version = "19.1.0-www-classic-df319522-20250317";
1537+
exports.version = "19.1.0-www-classic-8243f3f0-20250317";
15381538
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15391539
"function" ===
15401540
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ __DEV__ &&
9696
switch (type) {
9797
case REACT_FRAGMENT_TYPE:
9898
return "Fragment";
99-
case REACT_PORTAL_TYPE:
100-
return "Portal";
10199
case REACT_PROFILER_TYPE:
102100
return "Profiler";
103101
case REACT_STRICT_MODE_TYPE:
@@ -121,6 +119,8 @@ __DEV__ &&
121119
),
122120
type.$$typeof)
123121
) {
122+
case REACT_PORTAL_TYPE:
123+
return "Portal";
124124
case REACT_PROVIDER_TYPE:
125125
if (enableRenderableContext) break;
126126
else return (type._context.displayName || "Context") + ".Provider";
@@ -1534,7 +1534,7 @@ __DEV__ &&
15341534
exports.useTransition = function () {
15351535
return resolveDispatcher().useTransition();
15361536
};
1537-
exports.version = "19.1.0-www-modern-df319522-20250317";
1537+
exports.version = "19.1.0-www-modern-8243f3f0-20250317";
15381538
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15391539
"function" ===
15401540
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,4 +641,4 @@ exports.useSyncExternalStore = function (
641641
exports.useTransition = function () {
642642
return ReactSharedInternals.H.useTransition();
643643
};
644-
exports.version = "19.1.0-www-classic-df319522-20250317";
644+
exports.version = "19.1.0-www-classic-8243f3f0-20250317";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,4 +641,4 @@ exports.useSyncExternalStore = function (
641641
exports.useTransition = function () {
642642
return ReactSharedInternals.H.useTransition();
643643
};
644-
exports.version = "19.1.0-www-modern-df319522-20250317";
644+
exports.version = "19.1.0-www-modern-8243f3f0-20250317";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ exports.useSyncExternalStore = function (
645645
exports.useTransition = function () {
646646
return ReactSharedInternals.H.useTransition();
647647
};
648-
exports.version = "19.1.0-www-classic-df319522-20250317";
648+
exports.version = "19.1.0-www-classic-8243f3f0-20250317";
649649
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
650650
"function" ===
651651
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ exports.useSyncExternalStore = function (
645645
exports.useTransition = function () {
646646
return ReactSharedInternals.H.useTransition();
647647
};
648-
exports.version = "19.1.0-www-modern-df319522-20250317";
648+
exports.version = "19.1.0-www-modern-8243f3f0-20250317";
649649
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
650650
"function" ===
651651
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)