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,
component?.key !== undefined &&
(isPortfolioLike(component?.qualifier) || (Boolean(branchLike) && !isFetchingBranch));
- const componentKey = useTopLevelComponentKey();
const { data: appLeaks } = useApplicationLeakQuery(
- componentKey ?? '',
+ component?.key ?? '',
isApplication(component?.qualifier),
);
const { data: historyData, isLoading: isLoadingHistory } = useAllMeasuresHistoryQuery(
{
- component: componentKey,
+ component: component?.key,
branchParams: getBranchLikeQuery(branchLike),
metrics: getHistoryMetrics(query.graph || DEFAULT_GRAPH, parsedQuery.customMetrics).join(','),
},