Skip to content

Commit

Permalink
Add cahce invalidations when creating/updating reviewers (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
HansGabriel authored Dec 17, 2023
1 parent fa17b87 commit dbe4b1f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion apps/expo/src/screens/create-reviewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ export const CreateReviewerScreen = ({
isLoading: isCreatingReviewer,
reset,
} = trpc.reviewer.createReviewer.useMutation({
onSuccess: () => {
trpcUtils.reviewer.invalidate();
},
onError: (error) => {
errorToast({
title: "Error",
Expand Down Expand Up @@ -137,7 +140,17 @@ export const CreateReviewerScreen = ({
});

const { mutate: updateReviewer, isLoading: isUpdatingReviewer } =
trpc.reviewer.updateReviewer.useMutation();
trpc.reviewer.updateReviewer.useMutation({
onSuccess: () => {
trpcUtils.reviewer.invalidate();
},
onError: (error) => {
errorToast({
title: "Error",
message: error.message,
});
},
});

const getDisplayImage = () => {
if (reviewerImage) {
Expand Down

0 comments on commit dbe4b1f

Please sign in to comment.