import { FlagMessage, Link, Spinner } from 'design-system';
import * as React from 'react';
import { translate } from '../../../../helpers/l10n';
-import { useBranchWarrningQuery } from '../../../../queries/branch';
+import { useBranchWarningQuery } from '../../../../queries/branch';
import { Task, TaskStatuses } from '../../../../types/tasks';
import { Component } from '../../../../types/types';
import { AnalysisErrorModal } from './AnalysisErrorModal';
export function AnalysisStatus(props: HeaderMetaProps) {
const { component, currentTask, isInProgress, isPending } = props;
- const { data: warnings, isLoading } = useBranchWarrningQuery(component);
+ const { data: warnings, isLoading } = useBranchWarningQuery(component);
const [modalIsVisible, setDisplayModal] = React.useState(false);
const openModal = React.useCallback(() => {
});
}
-export function useBranchWarrningQuery(component: Component) {
+export function useBranchWarningQuery(component: Component) {
const branchQuery = useBranchesQuery(component);
const branchLike = branchQuery.data?.branchLike;
+ const key = useBranchesQueryKey(InnerState.Warning);
return useQuery({
- queryKey: useBranchesQueryKey(InnerState.Warning),
+ queryKey: key,
queryFn: async ({ queryKey }) => {
const { query, componentKey } = getContext(queryKey);
const { component: branchStatus } = await getAnalysisStatus({
});
return branchStatus.warnings;
},
- enabled: !!branchLike && isProject(component.qualifier),
+ enabled: !!branchLike && isProject(component.qualifier) && component.key === key[1],
staleTime: BRANCHES_STALE_TIME,
});
}