Skip to content

Commit

Permalink
fix: invalidate query after delete mutation for enabling refetch.
Browse files Browse the repository at this point in the history
  • Loading branch information
brnovasco committed Feb 28, 2024
1 parent f4a2178 commit f7239bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pages/users/[user].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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: () => {
Expand Down

0 comments on commit f7239bc

Please sign in to comment.