diff --git a/web/src/components/ui/charts/TableChart/BusterTableChart.tsx b/web/src/components/ui/charts/TableChart/BusterTableChart.tsx index 8e92da2d7..666588fef 100644 --- a/web/src/components/ui/charts/TableChart/BusterTableChart.tsx +++ b/web/src/components/ui/charts/TableChart/BusterTableChart.tsx @@ -1,7 +1,6 @@ import React, { useCallback } from 'react'; import type { BusterTableChartConfig } from './interfaces'; import { formatLabel } from '@/lib/columnFormatter'; -import isEqual from 'lodash/isEqual'; import { type IBusterMetricChartConfig, type BusterChartPropsBase, @@ -11,9 +10,8 @@ import { useMemoizedFn } from '@/hooks'; import { AppDataGrid } from '@/components/ui/table/AppDataGrid'; import './TableChart.css'; import { cn } from '@/lib/classMerge'; +import isEmpty from 'lodash/isEmpty'; import { useUpdateMetricChart } from '@/context/Metrics'; -import { useUpdateMetric } from '@/api/buster_rest/metrics'; -import { useOriginalMetricStore } from '@/context/Metrics/useOriginalMetricStore'; export interface BusterTableChartProps extends BusterTableChartConfig, BusterChartPropsBase {} @@ -37,7 +35,10 @@ const BusterTableChartBase: React.FC = ({ if (readOnly) return; onUpdateMetricChartConfig({ chartConfig: config }); - if (tableColumnWidths === null && !!config.tableColumnWidths) { + if ( + (tableColumnWidths === null || isEmpty(tableColumnWidths)) && + !isEmpty(config.tableColumnWidths) + ) { onInitializeTableColumnWidths(config.tableColumnWidths); } }); diff --git a/web/src/context/Metrics/useUpdateMetricChart.ts b/web/src/context/Metrics/useUpdateMetricChart.ts index b727f85e9..a0da6e524 100644 --- a/web/src/context/Metrics/useUpdateMetricChart.ts +++ b/web/src/context/Metrics/useUpdateMetricChart.ts @@ -31,9 +31,6 @@ export const useUpdateMetricChart = (props?: { metricId?: string; chatId?: strin saveToServer: true, updateVersion: !chatId }); - const { mutateAsync: saveMetricToServerWithoutSideEffects } = useSaveMetric({ - updateOnSave: true - }); const getMetricMemoized = useGetMetricMemoized(); @@ -145,12 +142,6 @@ export const useUpdateMetricChart = (props?: { metricId?: string; chatId?: strin ...originalMetric, chart_config: newChartConfig }); - - saveMetricToServerWithoutSideEffects({ - id: metricId, - chart_config: newChartConfig, - update_version: false - }); } } );