]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-22698 Fix activity page for sub-portfolios
authorViktor Vorona <viktor.vorona@sonarsource.com>
Mon, 9 Sep 2024 13:40:38 +0000 (15:40 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 11 Sep 2024 20:03:48 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx

index f4cb3432bb31c6454b91eb0f4344207866fa270d..ee3b1c026d05dad4a8e28ced7ffefaf3c40fb506 100644 (file)
@@ -23,10 +23,7 @@ import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter
 import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
 import { isPortfolioLike } from '~sonar-aligned/helpers/component';
 import { MetricKey } from '~sonar-aligned/types/metrics';
-import {
-  useComponent,
-  useTopLevelComponentKey,
-} from '../../../app/components/componentContext/withComponentContext';
+import { useComponent } from '../../../app/components/componentContext/withComponentContext';
 import { useMetrics } from '../../../app/components/metrics/withMetricsContext';
 import {
   DEFAULT_GRAPH,
@@ -70,9 +67,8 @@ export function ProjectActivityApp() {
     component?.key !== undefined &&
     (isPortfolioLike(component?.qualifier) || (Boolean(branchLike) && !isFetchingBranch));
 
-  const componentKey = useTopLevelComponentKey();
   const { data: appLeaks } = useApplicationLeakQuery(
-    componentKey ?? '',
+    component?.key ?? '',
     isApplication(component?.qualifier),
   );
 
@@ -81,7 +77,7 @@ export function ProjectActivityApp() {
 
   const { data: historyData, isLoading: isLoadingHistory } = useAllMeasuresHistoryQuery(
     {
-      component: componentKey,
+      component: component?.key,
       branchParams: getBranchLikeQuery(branchLike),
       metrics: getHistoryMetrics(query.graph || DEFAULT_GRAPH, parsedQuery.customMetrics).join(','),
     },