Skip to content

Commit

Permalink
Move search path prefix destructuring in Chart component to wrapper #325
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBurgess committed Oct 2, 2024
1 parent dcc1681 commit 2e60a98
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ui/dashboard/src/components/dashboards/charts/Chart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ const buildChartOptions = (props: ChartProps, themeColors: any) => {

type ChartComponentProps = {
options: EChartsOption;
searchPathPrefix: string[];
type: ChartType | FlowType | GraphType | HierarchyType;
};

Expand Down Expand Up @@ -783,9 +784,8 @@ const handleClick = async (
}
};

const Chart = ({ options, type }: ChartComponentProps) => {
const Chart = ({ options, searchPathPrefix, type }: ChartComponentProps) => {
const [echarts, setEcharts] = useState<any | null>(null);
const { searchPathPrefix } = useDashboard();
const navigate = useNavigate();
const chartRef = useRef<ReactEChartsCore>(null);
const [imageUrl, setImageUrl] = useState<string | null>(null);
Expand Down Expand Up @@ -852,6 +852,7 @@ const Chart = ({ options, type }: ChartComponentProps) => {

const ChartWrapper = (props: ChartProps) => {
const {
searchPathPrefix,
themeContext: { wrapperRef },
} = useDashboard();
const themeColors = useChartThemeColors();
Expand All @@ -867,6 +868,7 @@ const ChartWrapper = (props: ChartProps) => {
return (
<Chart
options={buildChartOptions(props, themeColors)}
searchPathPrefix={searchPathPrefix}
type={props.display_type || "column"}
/>
);
Expand Down

0 comments on commit 2e60a98

Please sign in to comment.