From d12bd9507e6fc513f11eea1a17db775b7bf48454 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Tue, 5 Dec 2023 13:44:01 +0530 Subject: [PATCH] fix: leave project mutation (#2976) --- web/components/project/member-list-item.tsx | 9 +++++++-- web/components/project/sidebar-list-item.tsx | 2 +- web/components/workspace/settings/members-list-item.tsx | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/web/components/project/member-list-item.tsx b/web/components/project/member-list-item.tsx index 576accee9..74ff74450 100644 --- a/web/components/project/member-list-item.tsx +++ b/web/components/project/member-list-item.tsx @@ -33,6 +33,7 @@ export const ProjectMemberListItem: React.FC = observer((props) => { const { user: { currentUser, currentProjectMemberInfo, currentProjectRole, leaveProject }, projectMember: { removeMemberFromProject, updateMember }, + project: { fetchProjects }, } = useMobxStore(); // hooks const { setToastAlert } = useToast(); @@ -46,7 +47,11 @@ export const ProjectMemberListItem: React.FC = observer((props) => { if (memberDetails.id === currentUser?.id) { await leaveProject(workspaceSlug.toString(), projectId.toString()) - .then(() => router.push(`/${workspaceSlug}/projects`)) + .then(async () => { + await fetchProjects(workspaceSlug.toString()); + + router.push(`/${workspaceSlug}/projects`); + }) .catch((err) => setToastAlert({ type: "error", @@ -174,7 +179,7 @@ export const ProjectMemberListItem: React.FC = observer((props) => { onClick={() => setRemoveMemberModal(true)} className="opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto" > - + )} diff --git a/web/components/project/sidebar-list-item.tsx b/web/components/project/sidebar-list-item.tsx index 488ae571a..5ad757e5f 100644 --- a/web/components/project/sidebar-list-item.tsx +++ b/web/components/project/sidebar-list-item.tsx @@ -284,7 +284,7 @@ export const ProjectSidebarListItem: React.FC = observer((props) => {
- Leave Project + Leave project
)} diff --git a/web/components/workspace/settings/members-list-item.tsx b/web/components/workspace/settings/members-list-item.tsx index 7536e78c9..751fc14e1 100644 --- a/web/components/workspace/settings/members-list-item.tsx +++ b/web/components/workspace/settings/members-list-item.tsx @@ -243,7 +243,7 @@ export const WorkspaceMembersListItem: FC = observer((props) => { : "opacity-0 pointer-events-none" } > - +