Skip to content

Commit

Permalink
try out trpc utils invalidate
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Sutula <[email protected]>
  • Loading branch information
asutula committed Aug 10, 2024
1 parent 5ad008c commit 5f02e36
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ export default function EditProject({
{ retry: false },
);

const utils = api.useUtils();

const updateProject = api.projects.updateProject.useMutation({
onSuccess: (project) => {
router.replace(`/${team.slug}/${project.slug}/settings`);
router.refresh();
void utils.projects.projectBySlug.invalidate({
slug: project.slug,
teamId: team.id,
});
},
});

api.projects.projectBySlug.useQuery(
updateProject.data
? { slug: updateProject.data.slug, teamId: team.id }
: skipToken,
);

const onSubmit = (values: z.infer<typeof updateProjectSchema>) => {
updateProject.mutate({
projectId: project.id,
Expand Down

0 comments on commit 5f02e36

Please sign in to comment.