From ae164df69875046763ad35df7ec2a047901f23a2 Mon Sep 17 00:00:00 2001 From: Brendan O'Handley Date: Mon, 20 Nov 2023 14:33:16 -0500 Subject: [PATCH] Prometheus: Fix UI bug where a label with empty string shows as populated with the deleted label filter value (#78153) * preserve label with empty string * fix side effect of having undefined show up in the editor select for value * re render label item when label filters change --- .../components/LabelFilterItem.tsx | 10 ++++++---- .../components/LabelFilters.test.tsx | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilterItem.tsx b/public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilterItem.tsx index bdbe4795f9e..fdaa490f275 100644 --- a/public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilterItem.tsx +++ b/public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilterItem.tsx @@ -73,8 +73,10 @@ export function LabelFilterItem({ debounceDuration ); + const itemValue = item?.value ?? ''; + return ( -
+
{/* Label name select, loads all values at once */}