From ce0921bb15d1b41e18e6ca481a51676549784c2f Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Fri, 6 Jun 2025 16:15:54 +0200 Subject: [PATCH] ui: fix double metric selection in list --- .../components/Dashboard/components/MetricsList/ListView.tsx | 2 -- .../components/Dashboard/components/MetricsList/MetricsList.tsx | 1 + frontend/app/mstore/dashboardStore.ts | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/app/components/Dashboard/components/MetricsList/ListView.tsx b/frontend/app/components/Dashboard/components/MetricsList/ListView.tsx index cc8da4096..20470818d 100644 --- a/frontend/app/components/Dashboard/components/MetricsList/ListView.tsx +++ b/frontend/app/components/Dashboard/components/MetricsList/ListView.tsx @@ -117,8 +117,6 @@ const ListView: React.FC = ({ if (disableSelection) { const path = withSiteId(`/metrics/${metric.metricId}`, siteId); history.push(path); - } else { - toggleSelection?.(metric.metricId); } }; diff --git a/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx b/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx index f807f1a70..5c197336b 100644 --- a/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx +++ b/frontend/app/components/Dashboard/components/MetricsList/MetricsList.tsx @@ -50,6 +50,7 @@ function MetricsList({ }, [selectedMetrics, onSelectionChange]); const toggleMetricSelection = (id: any) => { + console.log(id) if (Array.isArray(id)) { setSelectedMetrics(id); return; diff --git a/frontend/app/mstore/dashboardStore.ts b/frontend/app/mstore/dashboardStore.ts index 21fc3de7e..165c88484 100644 --- a/frontend/app/mstore/dashboardStore.ts +++ b/frontend/app/mstore/dashboardStore.ts @@ -467,7 +467,7 @@ export default class DashboardStore { this.isSaving = true; try { try { - const response = await dashboardService.addWidget(dashboard, metricIds); + await dashboardService.addWidget(dashboard, metricIds); toast.success('Card added to dashboard.'); } catch { toast.error('Card could not be added.');