Skip to content

Commit

Permalink
Use both displayName and name in forwardRef/memo (#29625)
Browse files Browse the repository at this point in the history
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 commit 63d673c.
  • Loading branch information
sebmarkbage committed May 31, 2024
1 parent 6de1973 commit 6519b74
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<51857d1396b3dbf84785badc368366e6>>
* @generated SignedSource<<ea40271c035ce30c5310409717d735b1>>
*/

'use strict';
Expand Down Expand Up @@ -23471,7 +23471,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-8fd963a1e5-20240530';
var ReactVersion = '19.0.0-rc-63d673c676-20240531';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<62a7ec5b565b86a1ca4e89a8b6dfa33a>>
* @generated SignedSource<<23f6d952b269c7931513bf83add7e3a2>>
*/

"use strict";
Expand Down Expand Up @@ -9298,7 +9298,7 @@ var devToolsConfig$jscomp$inline_1047 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-rc-8fd963a1e5-20240530",
version: "19.0.0-rc-63d673c676-20240531",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1234 = {
Expand Down Expand Up @@ -9329,7 +9329,7 @@ var internals$jscomp$inline_1234 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8fd963a1e5-20240530"
reconcilerVersion: "19.0.0-rc-63d673c676-20240531"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1235 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<4ac434762822d6280d83c5cda5c1341b>>
* @generated SignedSource<<77de6052fd5afb506d6a239e73eff111>>
*/

"use strict";
Expand Down Expand Up @@ -9920,7 +9920,7 @@ var devToolsConfig$jscomp$inline_1130 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-rc-8fd963a1e5-20240530",
version: "19.0.0-rc-63d673c676-20240531",
rendererPackageName: "react-test-renderer"
};
(function (internals) {
Expand Down Expand Up @@ -9964,7 +9964,7 @@ var devToolsConfig$jscomp$inline_1130 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8fd963a1e5-20240530"
reconcilerVersion: "19.0.0-rc-63d673c676-20240531"
});
exports._Scheduler = Scheduler;
exports.act = act;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d88d69aa4000a33e09ec957377ca26f8>>
* @generated SignedSource<<b0d3934d3f94c323f5dceca1027771bc>>
*/

'use strict';
Expand All @@ -24,7 +24,7 @@ if (
}
var dynamicFlagsUntyped = require('ReactNativeInternalFeatureFlags');

var ReactVersion = '19.0.0-rc-8fd963a1e5-20240530';
var ReactVersion = '19.0.0-rc-63d673c676-20240531';

// Re-export dynamic flags from the internal module.
var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-exporting to avoid a dynamic look-up on
Expand Down Expand Up @@ -2374,6 +2374,7 @@ function forwardRef(render) {
Object.defineProperty(render, 'name', {
value: name
});
render.displayName = name;
}
}
});
Expand Down Expand Up @@ -2416,6 +2417,7 @@ function memo(type, compare) {
Object.defineProperty(type, 'name', {
value: name
});
type.displayName = name;
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<4cc9db1802bfed728048b5d62af26b8b>>
* @generated SignedSource<<5f42184f82d0ab1250887a32d55c29a0>>
*/

"use strict";
Expand Down Expand Up @@ -604,4 +604,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-rc-8fd963a1e5-20240530";
exports.version = "19.0.0-rc-63d673c676-20240531";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<c411b87ad31eb8487965b83bc03b44eb>>
* @generated SignedSource<<743f823a6f8f8eb06f134932fe991be8>>
*/

"use strict";
Expand Down Expand Up @@ -608,7 +608,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-rc-8fd963a1e5-20240530";
exports.version = "19.0.0-rc-63d673c676-20240531";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8fd963a1e5ec89459cac27fb1d9ad193a0604110
63d673c67656390d776bfa082c6ab49f0c636582
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<561a3a04b6eef3ab839c5c6c89289a8f>>
* @generated SignedSource<<7e1d8d0b4449f46fa2640edc742d6a96>>
*/

'use strict';
Expand Down Expand Up @@ -26206,7 +26206,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-8fd963a1e5-20240530';
var ReactVersion = '19.0.0-rc-63d673c676-20240531';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<43e2d3a64b19f02f63428367b171ef83>>
* @generated SignedSource<<071882b6067125b45e35f71baad6c318>>
*/

"use strict";
Expand Down Expand Up @@ -10551,7 +10551,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1124 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-rc-8fd963a1e5-20240530",
version: "19.0.0-rc-63d673c676-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -10594,7 +10594,7 @@ var internals$jscomp$inline_1350 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8fd963a1e5-20240530"
reconcilerVersion: "19.0.0-rc-63d673c676-20240531"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1351 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<01c2ef8f2c76da87ab46ae77a3777990>>
* @generated SignedSource<<a910b0563dc3cff556004cab592c2586>>
*/

"use strict";
Expand Down Expand Up @@ -11257,7 +11257,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1205 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-rc-8fd963a1e5-20240530",
version: "19.0.0-rc-63d673c676-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -11313,7 +11313,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8fd963a1e5-20240530"
reconcilerVersion: "19.0.0-rc-63d673c676-20240531"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<df51ec7f297fbc971a9a0a5374b59a13>>
* @generated SignedSource<<975424fe5a79f4d92111f31a8ea29609>>
*/

'use strict';
Expand Down Expand Up @@ -26562,7 +26562,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-8fd963a1e5-20240530';
var ReactVersion = '19.0.0-rc-63d673c676-20240531';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<4a450db295f67ea9874238584c4f431f>>
* @generated SignedSource<<9b5aff4e3db82b939b2752983359a102>>
*/

"use strict";
Expand Down Expand Up @@ -10696,11 +10696,11 @@ function traverseOwnerTreeUp(hierarchy, instance) {
traverseOwnerTreeUp(hierarchy, instance);
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-rc-8fd963a1e5-20240530" !== isomorphicReactPackageVersion)
if ("19.0.0-rc-63d673c676-20240531" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-rc-8fd963a1e5-20240530\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-rc-63d673c676-20240531\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
Expand Down Expand Up @@ -10750,7 +10750,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1192 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-rc-8fd963a1e5-20240530",
version: "19.0.0-rc-63d673c676-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -10793,7 +10793,7 @@ var internals$jscomp$inline_1439 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8fd963a1e5-20240530"
reconcilerVersion: "19.0.0-rc-63d673c676-20240531"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1440 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<0667378dfc8028ec5ee4bb3c1517736f>>
* @generated SignedSource<<67ac298976ac0cf56b836f4aa5c2b287>>
*/

"use strict";
Expand Down Expand Up @@ -11403,11 +11403,11 @@ function traverseOwnerTreeUp(hierarchy, instance) {
traverseOwnerTreeUp(hierarchy, instance);
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-rc-8fd963a1e5-20240530" !== isomorphicReactPackageVersion)
if ("19.0.0-rc-63d673c676-20240531" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-rc-8fd963a1e5-20240530\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-rc-63d673c676-20240531\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
Expand Down Expand Up @@ -11457,7 +11457,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1273 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-rc-8fd963a1e5-20240530",
version: "19.0.0-rc-63d673c676-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -11513,7 +11513,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8fd963a1e5-20240530"
reconcilerVersion: "19.0.0-rc-63d673c676-20240531"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {
Expand Down

0 comments on commit 6519b74

Please sign in to comment.