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

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