Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DevTools] Remove displayName from inspected data #30841

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions packages/react-devtools-shared/src/backend/fiber/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4212,7 +4212,6 @@ export function attach(

key: key != null ? key : null,

displayName: getDisplayNameForFiber(fiber),
type: elementType,

// Inspectable properties.
Expand Down Expand Up @@ -4252,13 +4251,6 @@ export function attach(
typeof componentInfo.key === 'string' ? componentInfo.key : null;
const props = null; // TODO: Track props on ReactComponentInfo;

const env = componentInfo.env;
let displayName = componentInfo.name || '';
if (typeof env === 'string') {
// We model environment as an HoC name for now.
displayName = env + '(' + displayName + ')';
}

const owners: null | Array<SerializedElement> =
getOwnersListFromInstance(virtualInstance);

Expand Down Expand Up @@ -4311,7 +4303,6 @@ export function attach(

key: key,

displayName: displayName,
type: ElementTypeVirtual,

// Inspectable properties.
Expand Down Expand Up @@ -4675,10 +4666,12 @@ export function attach(
return;
}

const displayName = getDisplayNameForElementID(id);

const supportsGroup = typeof console.groupCollapsed === 'function';
if (supportsGroup) {
console.groupCollapsed(
`[Click to expand] %c<${result.displayName || 'Component'} />`,
`[Click to expand] %c<${displayName || 'Component'} />`,
// --dom-tag-name-color is the CSS variable Chrome styles HTML elements with in the console.
'color: var(--dom-tag-name-color); font-weight: normal;',
);
Expand Down
8 changes: 4 additions & 4 deletions packages/react-devtools-shared/src/backend/legacy/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ export function attach(
return null;
}

const {displayName, key} = getData(internalInstance);
const {key} = getData(internalInstance);
const type = getElementType(internalInstance);

let context = null;
Expand Down Expand Up @@ -842,8 +842,6 @@ export function attach(
// Only legacy context exists in legacy versions.
hasLegacyContext: true,

displayName: displayName,

type: type,

key: key != null ? key : null,
Expand Down Expand Up @@ -876,10 +874,12 @@ export function attach(
return;
}

const displayName = getDisplayNameForElementID(id);

const supportsGroup = typeof console.groupCollapsed === 'function';
if (supportsGroup) {
console.groupCollapsed(
`[Click to expand] %c<${result.displayName || 'Component'} />`,
`[Click to expand] %c<${displayName || 'Component'} />`,
// --dom-tag-name-color is the CSS variable Chrome styles HTML elements with in the console.
'color: var(--dom-tag-name-color); font-weight: normal;',
);
Expand Down
2 changes: 0 additions & 2 deletions packages/react-devtools-shared/src/backend/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ export type OwnersList = {
export type InspectedElement = {
id: number,

displayName: string | null,

// Does the current renderer support editable hooks and function props?
canEditHooks: boolean,
canEditFunctionProps: boolean,
Expand Down
Loading