Branch details invalidation (#1973)

Fix branch details invalidation
This commit is contained in:
Eduard Heimbuch
2022-03-14 09:46:11 +01:00
committed by GitHub
parent 4e96168a96
commit 8cafb9e38f
2 changed files with 4 additions and 5 deletions

View File

@@ -0,0 +1,2 @@
- type: fixed
description: Branch details invalidation ([#1973](https://github.com/scm-manager/scm-manager/pull/1973))

View File

@@ -47,7 +47,7 @@ export const useBranches = (repository: Repository): ApiResult<BranchCollection>
() => apiClient.get(link).then(response => response.json()), () => apiClient.get(link).then(response => response.json()),
{ {
onSuccess: () => { onSuccess: () => {
return queryClient.invalidateQueries(branchQueryKey(repository, "details")); return queryClient.invalidateQueries(branchDetailsQueryKey(repository));
} }
} }
// we do not populate the cache for a single branch, // we do not populate the cache for a single branch,
@@ -79,10 +79,7 @@ function chunkBranches(branches: Branch[]) {
return chunks; return chunks;
} }
const branchDetailsQueryKey = ( const branchDetailsQueryKey = (repository: NamespaceAndName, branch: string | undefined = undefined) => {
repository: NamespaceAndName,
branch: string | undefined = undefined
) => {
let branchName; let branchName;
if (!branch) { if (!branch) {
branchName = "_"; branchName = "_";