From f7239bcc2f0000c1aa3f1a6406581726809c1de8 Mon Sep 17 00:00:00 2001 From: Bruno Carlos Date: Wed, 28 Feb 2024 14:18:05 -0300 Subject: [PATCH] fix: invalidate query after delete mutation for enabling refetch. --- src/pages/users/[user].tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/users/[user].tsx b/src/pages/users/[user].tsx index 4dc7bae..00cf912 100644 --- a/src/pages/users/[user].tsx +++ b/src/pages/users/[user].tsx @@ -49,6 +49,7 @@ export default User; function UserWorkspaces() { const { data: userWorkspaces, isLoading } = api.workspaceDbState.getUserWorkspaces.useQuery(); + const utils = api.useUtils(); const { setWorkspacePath, initNodes, initEdges, updateStateSnapshot } = useStoreActions(); @@ -80,7 +81,8 @@ function UserWorkspaces() { ); const { mutate: deleteWorkspace } = api.ssh.rmWorkspace.useMutation({ - onSuccess: () => { + onSuccess: async () => { + await utils.workspaceDbState.getUserWorkspaces.invalidate(); toast.success('Workspace deleted'); }, onError: () => {