♻️ Improve query invalidation (#659)

This commit is contained in:
Luke Vella 2023-04-08 12:43:54 +01:00 committed by GitHub
parent 0ad5abb590
commit 5b6d8424af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 26 deletions

View file

@ -22,8 +22,10 @@ export const DeletePollForm: React.FunctionComponent<{
const confirmationText = watch("confirmation");
const canDelete = confirmationText === confirmText;
const posthog = usePostHog();
const queryClient = trpc.useContext();
const deletePoll = trpc.polls.delete.useMutation({
onSuccess: () => {
queryClient.polls.invalidate();
posthog?.capture("deleted poll");
},
});