♻️ 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

@ -95,8 +95,10 @@ const ChangeNameModal = (props: {
onDone: () => void;
}) => {
const posthog = usePostHog();
const queryClient = trpc.useContext();
const changeName = trpc.polls.participants.rename.useMutation({
onSuccess: (_, { participantId, newName }) => {
queryClient.polls.participants.invalidate();
posthog?.capture("changed name", {
participantId,
oldName: props.oldName,