aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/queries
diff options
context:
space:
mode:
author7PH <benjamin.raymond@sonarsource.com>2023-08-31 13:49:59 +0200
committersonartech <sonartech@sonarsource.com>2023-08-31 20:02:57 +0000
commit7b6de25ed7b86a9c6a4ec44b33c4711011ebea1e (patch)
tree56bcc9e0847868fcd8e86342566154b98a32e233 /server/sonar-web/src/main/js/queries
parent759862025d953bcaeb3919b28ef393511564e924 (diff)
downloadsonarqube-7b6de25ed7b86a9c6a4ec44b33c4711011ebea1e.tar.gz
sonarqube-7b6de25ed7b86a9c6a4ec44b33c4711011ebea1e.zip
SONAR-20283 Fix API call consistently failing after navigating back to an application
Diffstat (limited to 'server/sonar-web/src/main/js/queries')
-rw-r--r--server/sonar-web/src/main/js/queries/branch.tsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/queries/branch.tsx b/server/sonar-web/src/main/js/queries/branch.tsx
index 8fb5bd706b6..604c347231e 100644
--- a/server/sonar-web/src/main/js/queries/branch.tsx
+++ b/server/sonar-web/src/main/js/queries/branch.tsx
@@ -166,11 +166,12 @@ export function useBranchStatusQuery(component: Component) {
});
}
-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({
@@ -179,7 +180,7 @@ export function useBranchWarrningQuery(component: Component) {
});
return branchStatus.warnings;
},
- enabled: !!branchLike && isProject(component.qualifier),
+ enabled: !!branchLike && isProject(component.qualifier) && component.key === key[1],
staleTime: BRANCHES_STALE_TIME,
});
}