Skip to content

Commit

Permalink
[core] Fix missing context display names
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Feb 20, 2024
1 parent 8a88e22 commit 8814e5e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/x-charts/src/Gauge/GaugeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ 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: 4 additions & 0 deletions packages/x-charts/src/context/CartesianContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export const CartesianContext = React.createContext<{
// @ts-ignore
}>({ xAxis: {}, yAxis: {}, xAxisIds: [], yAxisIds: [] });

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

function CartesianContextProvider(props: CartesianContextProviderProps) {
const { xAxis: inXAxis, yAxis: inYAxis, dataset, children } = props;
const formattedSeries = React.useContext(SeriesContext);
Expand Down
15 changes: 12 additions & 3 deletions packages/x-charts/src/context/DrawingProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ export const DrawingContext = React.createContext<
width: 400,
chartId: '',
});
export const SVGContext = React.createContext<React.RefObject<SVGSVGElement>>({ current: null });

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

export const SvgContext = React.createContext<React.RefObject<SVGSVGElement>>({ current: null });

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

function DrawingProvider(props: DrawingProviderProps) {
const { width, height, margin, svgRef, children } = props;
Expand All @@ -67,9 +76,9 @@ function DrawingProvider(props: DrawingProviderProps) {
);

return (
<SVGContext.Provider value={svgRef}>
<SvgContext.Provider value={svgRef}>
<DrawingContext.Provider value={value}>{children}</DrawingContext.Provider>
</SVGContext.Provider>
</SvgContext.Provider>
);
}

Expand Down
4 changes: 4 additions & 0 deletions packages/x-charts/src/context/HighlightProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export const HighlighContext = React.createContext<HighlighState>({
dispatch: () => null,
});

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

const dataReducer: React.Reducer<Omit<HighlighState, 'dispatch'>, HighlighActions> = (
prevState,
action,
Expand Down
4 changes: 4 additions & 0 deletions packages/x-charts/src/context/InteractionProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export const InteractionContext = React.createContext<InteractionState>({
dispatch: () => null,
});

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

const dataReducer: React.Reducer<Omit<InteractionState, 'dispatch'>, InteractionActions> = (
prevState,
action,
Expand Down
4 changes: 4 additions & 0 deletions packages/x-charts/src/context/SeriesContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export type FormattedSeries = { [type in ChartSeriesType]?: FormatterResult<type

export const SeriesContext = React.createContext<FormattedSeries>({});

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

const seriesTypeFormatter: {
[type in ChartSeriesType]?: (series: any, dataset?: DatasetType) => any;
} = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import * as React from 'react';
import { MuiLicenseInfo } from '../utils/licenseInfo';

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

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

export default MuiLicenseInfoContext;

0 comments on commit 8814e5e

Please sign in to comment.