From 8cafb9e38f63b2a7852e5a1183e8cfb0eb2c419c Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Mon, 14 Mar 2022 09:46:11 +0100 Subject: [PATCH] Branch details invalidation (#1973) Fix branch details invalidation --- gradle/changelog/branch_details_invalidation.yaml | 2 ++ scm-ui/ui-api/src/branches.ts | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 gradle/changelog/branch_details_invalidation.yaml diff --git a/gradle/changelog/branch_details_invalidation.yaml b/gradle/changelog/branch_details_invalidation.yaml new file mode 100644 index 0000000000..50fea47b9e --- /dev/null +++ b/gradle/changelog/branch_details_invalidation.yaml @@ -0,0 +1,2 @@ +- type: fixed + description: Branch details invalidation ([#1973](https://github.com/scm-manager/scm-manager/pull/1973)) diff --git a/scm-ui/ui-api/src/branches.ts b/scm-ui/ui-api/src/branches.ts index a371b4109f..c815c5b826 100644 --- a/scm-ui/ui-api/src/branches.ts +++ b/scm-ui/ui-api/src/branches.ts @@ -47,7 +47,7 @@ export const useBranches = (repository: Repository): ApiResult () => 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 = "_";