From b2eb04cb77ed01b928695b4f100cebe18cfb0170 Mon Sep 17 00:00:00 2001 From: Viktor Vorona Date: Mon, 9 Sep 2024 15:40:38 +0200 Subject: [PATCH] SONAR-22698 Fix activity page for sub-portfolios --- .../projectActivity/components/ProjectActivityApp.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx index f4cb3432bb3..ee3b1c026d0 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx @@ -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(','), }, -- 2.39.5