From f136a8b3c980681c11825fbf546cdeddbf0bbe01 Mon Sep 17 00:00:00 2001 From: Viktor Vorona Date: Fri, 23 Aug 2024 14:37:39 +0200 Subject: [PATCH] SONAR-22728 Fix hidden components message for measures list view --- .../apps/component-measures/components/MeasureContent.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx index dd252561131..e3dd0120797 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx @@ -117,11 +117,13 @@ export default function MeasureContent(props: Readonly) { const [selectedComponent, setSelectedComponent] = React.useState(); - const metric = metrics[requestedMetric.key]; - metric.direction = requestedMetric.direction; + const metric = treeData?.pages[0]?.metrics.find((m) => m.key === requestedMetric.key); + if (metric !== undefined) { + metric.direction = requestedMetric.direction; + } const baseComponent = treeData?.pages[0].baseComponent; - if (!baseComponent) { + if (!baseComponent || !metric) { return null; } -- 2.39.5