From 1956da2b900c821317bc2b46fdf3d939448c323b Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:06:10 +0530 Subject: [PATCH] fix: leave project mutation (#5175) --- web/core/store/user/user-membership.store.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/web/core/store/user/user-membership.store.ts b/web/core/store/user/user-membership.store.ts index efe58eac0..ecc73e16f 100644 --- a/web/core/store/user/user-membership.store.ts +++ b/web/core/store/user/user-membership.store.ts @@ -249,14 +249,10 @@ export class UserMembershipStore implements IUserMembershipStore { */ leaveProject = async (workspaceSlug: string, projectId: string) => await this.userService.leaveProject(workspaceSlug, projectId).then(() => { - const newPermissions: { [projectId: string]: boolean } = {}; - newPermissions[projectId] = false; - runInAction(() => { - this.hasPermissionToProject = { - ...this.hasPermissionToProject, - ...newPermissions, - }; - }); + // remove the user membership for a project + set(this.hasPermissionToProject, [projectId], false); + // update the project member list with the new permissions + set(this.store.projectRoot.project.projectMap, [projectId, "is_member"], false); }); /**