From ae002c0d88f275bf2d48e22c244f1478ebb93434 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Tue, 12 Nov 2024 11:42:25 +0000 Subject: [PATCH] Add validation for start and end date in MetricView to prevent loading without valid dates --- Dashboard/src/Components/Metrics/MetricView.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Dashboard/src/Components/Metrics/MetricView.tsx b/Dashboard/src/Components/Metrics/MetricView.tsx index 362e4636c6..1253c65d78 100644 --- a/Dashboard/src/Components/Metrics/MetricView.tsx +++ b/Dashboard/src/Components/Metrics/MetricView.tsx @@ -396,6 +396,14 @@ const MetricView: FunctionComponent = ( async (): Promise => { setIsMetricResultsLoading(true); + if ( + !metricViewData.startAndEndDate?.startValue || + !metricViewData.startAndEndDate?.endValue + ) { + setIsMetricResultsLoading(false); + return; + } + const results: Array = []; try { for (const queryConfig of metricViewData.queryConfigs) {