Skip to content

Commit 0aad3db

Browse files
committed
Use both displayName and name in forwardRef/memo (#29625)
When defining a displayName on forwardRef/memo we forward that name to the inner function. We used to use displayName for this but in #29206 I switched this to use `"name"`. That's because V8 doesn't use displayName, it only uses the overridden name in stack traces. This is the only thing covered by our tests for component stacks. However, I realized that Safari only uses displayName and not the name. So this sets both. DiffTrain build for [63d673c](63d673c)
1 parent e2fbd8f commit 0aad3db

32 files changed

+62
-58
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8fd963a1e5ec89459cac27fb1d9ad193a0604110
1+
63d673c67656390d776bfa082c6ab49f0c636582
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8fd963a1e5ec89459cac27fb1d9ad193a0604110
1+
63d673c67656390d776bfa082c6ab49f0c636582

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (
2222
) {
2323
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2424
}
25-
var ReactVersion = '19.0.0-www-classic-8fd963a1e5-20240530';
25+
var ReactVersion = '19.0.0-www-classic-63d673c676-20240531';
2626

2727
// Re-export dynamic flags from the www version.
2828
var dynamicFeatureFlags = require('ReactFeatureFlags');
@@ -2751,6 +2751,7 @@ function forwardRef(render) {
27512751
Object.defineProperty(render, 'name', {
27522752
value: name
27532753
});
2754+
render.displayName = name;
27542755
}
27552756
}
27562757
});
@@ -2793,6 +2794,7 @@ function memo(type, compare) {
27932794
Object.defineProperty(type, 'name', {
27942795
value: name
27952796
});
2797+
type.displayName = name;
27962798
}
27972799
}
27982800
});

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (
2222
) {
2323
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2424
}
25-
var ReactVersion = '19.0.0-www-modern-8fd963a1e5-20240530';
25+
var ReactVersion = '19.0.0-www-modern-63d673c676-20240531';
2626

2727
// Re-export dynamic flags from the www version.
2828
var dynamicFeatureFlags = require('ReactFeatureFlags');
@@ -2754,6 +2754,7 @@ function forwardRef(render) {
27542754
Object.defineProperty(render, 'name', {
27552755
value: name
27562756
});
2757+
render.displayName = name;
27572758
}
27582759
}
27592760
});
@@ -2796,6 +2797,7 @@ function memo(type, compare) {
27962797
Object.defineProperty(type, 'name', {
27972798
value: name
27982799
});
2800+
type.displayName = name;
27992801
}
28002802
}
28012803
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,4 +684,4 @@ exports.useSyncExternalStore = function (
684684
exports.useTransition = function () {
685685
return ReactSharedInternals.H.useTransition();
686686
};
687-
exports.version = "19.0.0-www-classic-8fd963a1e5-20240530";
687+
exports.version = "19.0.0-www-classic-63d673c676-20240531";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,4 +684,4 @@ exports.useSyncExternalStore = function (
684684
exports.useTransition = function () {
685685
return ReactSharedInternals.H.useTransition();
686686
};
687-
exports.version = "19.0.0-www-modern-8fd963a1e5-20240530";
687+
exports.version = "19.0.0-www-modern-63d673c676-20240531";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ exports.useSyncExternalStore = function (
688688
exports.useTransition = function () {
689689
return ReactSharedInternals.H.useTransition();
690690
};
691-
exports.version = "19.0.0-www-classic-8fd963a1e5-20240530";
691+
exports.version = "19.0.0-www-classic-63d673c676-20240531";
692692
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
693693
"function" ===
694694
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
@@ -688,7 +688,7 @@ exports.useSyncExternalStore = function (
688688
exports.useTransition = function () {
689689
return ReactSharedInternals.H.useTransition();
690690
};
691-
exports.version = "19.0.0-www-modern-8fd963a1e5-20240530";
691+
exports.version = "19.0.0-www-modern-63d673c676-20240531";
692692
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
693693
"function" ===
694694
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function _assertThisInitialized(self) {
6060
return self;
6161
}
6262

63-
var ReactVersion = '19.0.0-www-classic-8fd963a1e5-20240530';
63+
var ReactVersion = '19.0.0-www-classic-63d673c676-20240531';
6464

6565
var LegacyRoot = 0;
6666
var ConcurrentRoot = 1;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function _assertThisInitialized(self) {
6060
return self;
6161
}
6262

63-
var ReactVersion = '19.0.0-www-modern-8fd963a1e5-20240530';
63+
var ReactVersion = '19.0.0-www-modern-63d673c676-20240531';
6464

6565
var LegacyRoot = 0;
6666
var ConcurrentRoot = 1;

0 commit comments

Comments
 (0)