]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-22728 Fix hidden components message for measures list view
authorViktor Vorona <viktor.vorona@sonarsource.com>
Fri, 23 Aug 2024 12:37:39 +0000 (14:37 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 26 Aug 2024 20:03:08 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx

index dd252561131b96f675a08151344f932f6f1fae7f..e3dd0120797867b707a45fcb89c850e4ef602e4e 100644 (file)
@@ -117,11 +117,13 @@ export default function MeasureContent(props: Readonly<Props>) {
 
   const [selectedComponent, setSelectedComponent] = React.useState<ComponentMeasureEnhanced>();
 
-  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;
   }