Skip to content

Commit ca10630

Browse files
committed
memoize pie charts chartConfig
1 parent 3654f45 commit ca10630

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/charts/src/components/PieChart/PieChart.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,20 @@ const PieChart: FC<PieChartProps> = forwardRef((props: PieChartProps, ref: Ref<a
6565
onDataPointClick,
6666
onLegendClick,
6767
centerLabel,
68-
chartConfig = {
69-
legendPosition: 'bottom',
70-
paddingAngle: 0,
71-
innerRadius: undefined
72-
},
7368
style,
7469
className,
7570
tooltip,
7671
slot
7772
} = props;
73+
74+
const chartConfig = useMemo(() => {
75+
return {
76+
legendPosition: 'bottom',
77+
paddingAngle: 0,
78+
...props.chartConfig
79+
};
80+
}, [props.chartConfig]);
81+
7882
const dimension: DimensionConfig = useMemo(
7983
() => ({
8084
formatter: (d) => d,

0 commit comments

Comments
 (0)