Skip to content

Commit

Permalink
fix: mutation latency in sidebar projects when user leaves the project (
Browse files Browse the repository at this point in the history
#2083)

* fix: mutation latency in sidebar projects when user leaves the project

* chore: remove console
  • Loading branch information
gurusainath authored Sep 4, 2023
1 parent 2c9c8d5 commit faf5a27
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions web/components/project/confirm-project-leave-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from "react";
// next imports
import { useRouter } from "next/router";
// swr
import { mutate } from "swr";
// react-hook-form
import { Controller, useForm } from "react-hook-form";
// headless ui
Expand All @@ -21,6 +19,7 @@ import { RootStore } from "store/root";
// hooks
import useToast from "hooks/use-toast";
import useUser from "hooks/use-user";
import useProjects from "hooks/use-projects";
// types
import { IProject } from "types";

Expand All @@ -42,6 +41,7 @@ export const ConfirmProjectLeaveModal: React.FC = observer(() => {
const { project } = store;

const { user } = useUser();
const { mutateProjects } = useProjects();

const { setToastAlert } = useToast();

Expand All @@ -59,9 +59,6 @@ export const ConfirmProjectLeaveModal: React.FC = observer(() => {
reset({ ...defaultValues });
};

project?.projectLeaveDetails &&
console.log("project leave confirmation modal", project?.projectLeaveDetails);

const onSubmit = async (data: any) => {
if (data) {
if (data.projectName === project?.projectLeaveDetails?.name) {
Expand All @@ -73,13 +70,7 @@ export const ConfirmProjectLeaveModal: React.FC = observer(() => {
user
)
.then((res) => {
mutate<IProject[]>(
PROJECTS_LIST(project.projectLeaveDetails.workspaceSlug.toString(), {
is_favorite: "all",
}),
(prevData) => prevData?.filter((project: IProject) => project.id !== data.id),
false
);
mutateProjects();
handleClose();
router.push(`/${workspaceSlug}/projects`);
})
Expand Down

1 comment on commit faf5a27

@vercel
Copy link

@vercel vercel bot commented on faf5a27 Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-dev – ./web/

plane-dev-git-develop-plane.vercel.app
plane-dev.vercel.app
plane-dev-plane.vercel.app

Please sign in to comment.