remove query keys when deleting individual entities (#1832)

When deleting individual entities, their query keys should be removed, not only invalidated. This is to prevent situations, where an entity is deleted via the web interface and react-query attempts a re-fetch before a redirect to the collection view can occur. This could lead to a not found error.
This commit is contained in:
Konstantin Schaper
2021-10-20 13:15:17 +02:00
committed by GitHub
parent 6a881b3d98
commit d41b293109
6 changed files with 83 additions and 73 deletions

View File

@@ -127,7 +127,7 @@ export const useDeleteRepositoryRole = () => {
},
{
onSuccess: async (_, name) => {
await queryClient.invalidateQueries(["repositoryRole", name]);
await queryClient.removeQueries(["repositoryRole", name]);
await queryClient.invalidateQueries(["repositoryRoles"]);
},
}