Skip to content

Commit e511a53

Browse files
authored
[core] refactor: remove manual displayName (#17845)
1 parent af9793b commit e511a53

File tree

18 files changed

+21
-58
lines changed

18 files changed

+21
-58
lines changed

babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ module.exports = function getBabelConfig(api) {
9292
ignoreFilenames: ['DataGrid.tsx', 'DataGridPro.tsx'],
9393
},
9494
],
95+
'@mui/internal-babel-plugin-display-name',
9596
[
9697
'transform-inline-environment-variables',
9798
{

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
"@emotion/react": "^11.14.0",
8686
"@emotion/styled": "^11.14.0",
8787
"@mui/icons-material": "^7.0.2",
88+
"@mui/internal-babel-plugin-display-name": "github:mui/mui-public#master&path:./packages/babel-plugin-display-name",
8889
"@mui/internal-babel-plugin-resolve-imports": "^2.0.1",
8990
"@mui/internal-markdown": "^2.0.4",
9091
"@mui/internal-test-utils": "^2.0.7",

packages/x-charts/src/ChartsLocalizationProvider/ChartsLocalizationProvider.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ export const ChartsLocalizationContext = React.createContext<ChartsLocalizationC
1313
null,
1414
);
1515

16-
if (process.env.NODE_ENV !== 'production') {
17-
ChartsLocalizationContext.displayName = 'ChartsLocalizationContext';
18-
}
19-
2016
export interface ChartsLocalizationProviderProps {
2117
children?: React.ReactNode;
2218
/**

packages/x-charts/src/Gauge/GaugeProvider.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ export const GaugeContext = React.createContext<
127127
valueAngle: null,
128128
});
129129

130-
if (process.env.NODE_ENV !== 'production') {
131-
GaugeContext.displayName = 'GaugeContext';
132-
}
133-
134130
export interface GaugeProviderProps extends GaugeConfig, CircularConfig {
135131
children: React.ReactNode;
136132
}

packages/x-charts/src/context/ChartProvider/ChartContext.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,3 @@ import type { ChartContextValue } from './ChartProvider.types';
55
* @ignore - internal component.
66
*/
77
export const ChartContext = React.createContext<ChartContextValue<any> | null>(null);
8-
9-
if (process.env.NODE_ENV !== 'production') {
10-
ChartContext.displayName = 'ChartContext';
11-
}

packages/x-data-grid/src/components/GridApiContext.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@
22
import * as React from 'react';
33

44
export const GridApiContext = React.createContext<unknown>(undefined);
5-
6-
if (process.env.NODE_ENV !== 'production') {
7-
GridApiContext.displayName = 'GridApiContext';
8-
}

packages/x-data-grid/src/components/GridConfigurationContext.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@
22
import * as React from 'react';
33

44
export const GridConfigurationContext = React.createContext<unknown>(undefined);
5-
6-
if (process.env.NODE_ENV !== 'production') {
7-
GridConfigurationContext.displayName = 'GridConfigurationContext';
8-
}

packages/x-data-grid/src/context/GridRootPropsContext.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,4 @@ import * as React from 'react';
33

44
const GridRootPropsContext = React.createContext<unknown>(undefined);
55

6-
if (process.env.NODE_ENV !== 'production') {
7-
GridRootPropsContext.displayName = 'GridRootPropsContext';
8-
}
9-
106
export { GridRootPropsContext };

packages/x-data-grid/src/hooks/utils/useGridPrivateApiContext.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import { GridPrivateApiCommunity } from '../../models/api/gridApiCommunity';
55

66
export const GridPrivateApiContext = React.createContext<unknown>(undefined);
77

8-
if (process.env.NODE_ENV !== 'production') {
9-
GridPrivateApiContext.displayName = 'GridPrivateApiContext';
10-
}
11-
128
export function useGridPrivateApiContext<
139
PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity,
1410
>(): RefObject<PrivateApi> {

packages/x-date-pickers/src/LocalizationProvider/LocalizationProvider.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ export type MuiPickersAdapterContextNullableValue = {
2222
export const MuiPickersAdapterContext =
2323
React.createContext<MuiPickersAdapterContextNullableValue | null>(null);
2424

25-
if (process.env.NODE_ENV !== 'production') {
26-
MuiPickersAdapterContext.displayName = 'MuiPickersAdapterContext';
27-
}
28-
2925
export interface LocalizationProviderProps<TLocale> {
3026
children?: React.ReactNode;
3127
/**

packages/x-license/src/Unstable_LicenseInfoProvider/MuiLicenseInfoContext.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,4 @@ import { MuiLicenseInfo } from '../utils/licenseInfo';
44

55
const MuiLicenseInfoContext = React.createContext<MuiLicenseInfo>({ key: undefined });
66

7-
if (process.env.NODE_ENV !== 'production') {
8-
MuiLicenseInfoContext.displayName = 'MuiLicenseInfoContext';
9-
}
10-
117
export default MuiLicenseInfoContext;

packages/x-scheduler/src/joy/event-calendar/EventCalendar.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ import './EventCalendar.css';
55
export const EventCalendar = React.forwardRef(function EventCalendar() {
66
return <div className="EventCalendar">HELLO WORLD</div>;
77
});
8-
9-
EventCalendar.displayName = 'EventCalendar';

packages/x-tree-view/src/internals/TreeViewItemDepthContext/TreeViewItemDepthContext.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,3 @@ import type { UseTreeViewItemsSignature } from '../plugins/useTreeViewItems';
66
export const TreeViewItemDepthContext = React.createContext<
77
((state: TreeViewState<[UseTreeViewItemsSignature]>, itemId: TreeViewItemId) => number) | number
88
>(() => -1);
9-
10-
if (process.env.NODE_ENV !== 'production') {
11-
TreeViewItemDepthContext.displayName = 'TreeViewItemDepthContext';
12-
}

packages/x-tree-view/src/internals/TreeViewProvider/TreeViewChildrenItemProvider.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ import { selectorItemOrderedChildrenIds } from '../plugins/useTreeViewItems/useT
99
export const TreeViewChildrenItemContext =
1010
React.createContext<TreeViewChildrenItemContextValue | null>(null);
1111

12-
if (process.env.NODE_ENV !== 'production') {
13-
TreeViewChildrenItemContext.displayName = 'TreeViewChildrenItemContext';
14-
}
15-
1612
interface TreeViewChildrenItemProviderProps {
1713
itemId: string | null;
1814
idAttribute: string | null;

packages/x-tree-view/src/internals/TreeViewProvider/TreeViewContext.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ import { TreeViewContextValue } from './TreeViewProvider.types';
77
*/
88
export const TreeViewContext = React.createContext<TreeViewContextValue<any> | null>(null);
99

10-
if (process.env.NODE_ENV !== 'production') {
11-
TreeViewContext.displayName = 'TreeViewContext';
12-
}
13-
1410
export const useTreeViewContext = <
1511
TSignatures extends readonly TreeViewAnyPluginSignature[],
1612
TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = [],

packages/x-tree-view/src/internals/TreeViewProvider/TreeViewStyleContext.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ export const TreeViewStyleContext = React.createContext<TreeViewStyleContextValu
6363
slotProps: {},
6464
});
6565

66-
if (process.env.NODE_ENV !== 'production') {
67-
TreeViewStyleContext.displayName = 'TreeViewStyleContext';
68-
}
69-
7066
export const useTreeViewStyleContext = () => {
7167
return React.useContext(TreeViewStyleContext);
7268
};

packages/x-tree-view/src/internals/components/RichTreeViewItems.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ const RichTreeViewItemsContext = React.createContext<
1515
((itemId: TreeViewItemId) => React.ReactNode) | null
1616
>(null);
1717

18-
if (process.env.NODE_ENV !== 'production') {
19-
RichTreeViewItemsContext.displayName = 'RichTreeViewItemsProvider';
20-
}
21-
2218
const WrappedTreeItem = React.memo(function WrappedTreeItem({
2319
itemSlot,
2420
itemSlotProps,

pnpm-lock.yaml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)