Skip to content

[core] refactor: remove manual displayName #17845

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

Merged
merged 3 commits into from
May 19, 2025
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
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ module.exports = function getBabelConfig(api) {
ignoreFilenames: ['DataGrid.tsx', 'DataGridPro.tsx'],
},
],
'@mui/internal-babel-plugin-display-name',
[
'transform-inline-environment-variables',
{
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^7.0.2",
"@mui/internal-babel-plugin-display-name": "github:mui/mui-public#master&path:./packages/babel-plugin-display-name",
"@mui/internal-babel-plugin-resolve-imports": "^2.0.1",
"@mui/internal-markdown": "^2.0.4",
"@mui/internal-test-utils": "^2.0.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ export const ChartsLocalizationContext = React.createContext<ChartsLocalizationC
null,
);

if (process.env.NODE_ENV !== 'production') {
ChartsLocalizationContext.displayName = 'ChartsLocalizationContext';
}

export interface ChartsLocalizationProviderProps {
children?: React.ReactNode;
/**
Expand Down
4 changes: 0 additions & 4 deletions packages/x-charts/src/Gauge/GaugeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ export const GaugeContext = React.createContext<
valueAngle: null,
});

if (process.env.NODE_ENV !== 'production') {
GaugeContext.displayName = 'GaugeContext';
}

export interface GaugeProviderProps extends GaugeConfig, CircularConfig {
children: React.ReactNode;
}
Expand Down
4 changes: 0 additions & 4 deletions packages/x-charts/src/context/ChartProvider/ChartContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,3 @@ import type { ChartContextValue } from './ChartProvider.types';
* @ignore - internal component.
*/
export const ChartContext = React.createContext<ChartContextValue<any> | null>(null);

if (process.env.NODE_ENV !== 'production') {
ChartContext.displayName = 'ChartContext';
}
4 changes: 0 additions & 4 deletions packages/x-data-grid/src/components/GridApiContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
import * as React from 'react';

export const GridApiContext = React.createContext<unknown>(undefined);

if (process.env.NODE_ENV !== 'production') {
GridApiContext.displayName = 'GridApiContext';
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
import * as React from 'react';

export const GridConfigurationContext = React.createContext<unknown>(undefined);

if (process.env.NODE_ENV !== 'production') {
GridConfigurationContext.displayName = 'GridConfigurationContext';
}
4 changes: 0 additions & 4 deletions packages/x-data-grid/src/context/GridRootPropsContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@ import * as React from 'react';

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

if (process.env.NODE_ENV !== 'production') {
GridRootPropsContext.displayName = 'GridRootPropsContext';
}

export { GridRootPropsContext };
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import { GridPrivateApiCommunity } from '../../models/api/gridApiCommunity';

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

if (process.env.NODE_ENV !== 'production') {
GridPrivateApiContext.displayName = 'GridPrivateApiContext';
}

export function useGridPrivateApiContext<
PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity,
>(): RefObject<PrivateApi> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export type MuiPickersAdapterContextNullableValue = {
export const MuiPickersAdapterContext =
React.createContext<MuiPickersAdapterContextNullableValue | null>(null);

if (process.env.NODE_ENV !== 'production') {
MuiPickersAdapterContext.displayName = 'MuiPickersAdapterContext';
}

export interface LocalizationProviderProps<TLocale> {
children?: React.ReactNode;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,4 @@ import { MuiLicenseInfo } from '../utils/licenseInfo';

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

if (process.env.NODE_ENV !== 'production') {
MuiLicenseInfoContext.displayName = 'MuiLicenseInfoContext';
}

export default MuiLicenseInfoContext;
2 changes: 0 additions & 2 deletions packages/x-scheduler/src/joy/event-calendar/EventCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ import './EventCalendar.css';
export const EventCalendar = React.forwardRef(function EventCalendar() {
return <div className="EventCalendar">HELLO WORLD</div>;
});

EventCalendar.displayName = 'EventCalendar';
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@ import type { UseTreeViewItemsSignature } from '../plugins/useTreeViewItems';
export const TreeViewItemDepthContext = React.createContext<
((state: TreeViewState<[UseTreeViewItemsSignature]>, itemId: TreeViewItemId) => number) | number
>(() => -1);

if (process.env.NODE_ENV !== 'production') {
TreeViewItemDepthContext.displayName = 'TreeViewItemDepthContext';
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import { selectorItemOrderedChildrenIds } from '../plugins/useTreeViewItems/useT
export const TreeViewChildrenItemContext =
React.createContext<TreeViewChildrenItemContextValue | null>(null);

if (process.env.NODE_ENV !== 'production') {
TreeViewChildrenItemContext.displayName = 'TreeViewChildrenItemContext';
}

interface TreeViewChildrenItemProviderProps {
itemId: string | null;
idAttribute: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import { TreeViewContextValue } from './TreeViewProvider.types';
*/
export const TreeViewContext = React.createContext<TreeViewContextValue<any> | null>(null);

if (process.env.NODE_ENV !== 'production') {
TreeViewContext.displayName = 'TreeViewContext';
}

export const useTreeViewContext = <
TSignatures extends readonly TreeViewAnyPluginSignature[],
TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ export const TreeViewStyleContext = React.createContext<TreeViewStyleContextValu
slotProps: {},
});

if (process.env.NODE_ENV !== 'production') {
TreeViewStyleContext.displayName = 'TreeViewStyleContext';
}

export const useTreeViewStyleContext = () => {
return React.useContext(TreeViewStyleContext);
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ const RichTreeViewItemsContext = React.createContext<
((itemId: TreeViewItemId) => React.ReactNode) | null
>(null);

if (process.env.NODE_ENV !== 'production') {
RichTreeViewItemsContext.displayName = 'RichTreeViewItemsProvider';
}

const WrappedTreeItem = React.memo(function WrappedTreeItem({
itemSlot,
itemSlotProps,
Expand Down
19 changes: 19 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.