Skip to content

Commit

Permalink
fix(Chart): weaken visibility dependency to series
Browse files Browse the repository at this point in the history
  • Loading branch information
hduprat committed Jan 26, 2024
1 parent aa40d71 commit a6f5443
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/web-reporter-ui/src/components/Charts/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ export const Chart = ({
const chartOptions = useMemo(() => merge(commonOptions, options), [commonOptions, options]);

const ref = useRef<ReactApexChart>(null);
const seriesRef = useRef(series);
seriesRef.current = series;

useEffect(() => {
//@ts-expect-error chart is not defined in the typings, but it exists!
Expand All @@ -111,10 +113,10 @@ export const Chart = ({

toggleSeriesVisibility(
chart,
series.map((serie) => serie.name).filter((name): name is string => !!name),
seriesRef.current.map((serie) => serie.name).filter((name): name is string => !!name),
visibleSeriesNames
);
}, [series, visibleSeriesNames]);
}, [visibleSeriesNames]);

return (
<ReactApexChart ref={ref} options={chartOptions} series={series} type={type} height={height} />
Expand Down

0 comments on commit a6f5443

Please sign in to comment.