diff --git a/web/components/auth-screens/project/join-project.tsx b/web/components/auth-screens/project/join-project.tsx index d5841e43b..7ee4feacd 100644 --- a/web/components/auth-screens/project/join-project.tsx +++ b/web/components/auth-screens/project/join-project.tsx @@ -3,6 +3,7 @@ import Image from "next/image"; import { useRouter } from "next/router"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; +import { RootStore } from "store/root"; // ui import { Button } from "@plane/ui"; // icons @@ -14,8 +15,9 @@ export const JoinProject: React.FC = () => { const [isJoiningProject, setIsJoiningProject] = useState(false); const { + project: projectStore, user: { joinProject }, - } = useMobxStore(); + }: RootStore = useMobxStore(); const router = useRouter(); const { workspaceSlug, projectId } = router.query; @@ -25,9 +27,13 @@ export const JoinProject: React.FC = () => { setIsJoiningProject(true); - joinProject(workspaceSlug.toString(), [projectId.toString()]).finally(() => { - setIsJoiningProject(false); - }); + joinProject(workspaceSlug.toString(), [projectId.toString()]) + .then(() => { + projectStore.fetchProjects(workspaceSlug.toString()); + }) + .finally(() => { + setIsJoiningProject(false); + }); }; return ( diff --git a/web/components/project/join-project-modal.tsx b/web/components/project/join-project-modal.tsx index 8a4e6304d..4a3cad425 100644 --- a/web/components/project/join-project-modal.tsx +++ b/web/components/project/join-project-modal.tsx @@ -7,6 +7,7 @@ import { Button } from "@plane/ui"; import type { IProject } from "types"; // lib import { useMobxStore } from "lib/mobx/store-provider"; +import { RootStore } from "store/root"; // type type TJoinProjectModalProps = { @@ -22,8 +23,9 @@ export const JoinProjectModal: React.FC = (props) => { const [isJoiningLoading, setIsJoiningLoading] = useState(false); // store const { + project: projectStore, user: { joinProject }, - } = useMobxStore(); + }: RootStore = useMobxStore(); // router const router = useRouter(); @@ -33,6 +35,7 @@ export const JoinProjectModal: React.FC = (props) => { joinProject(workspaceSlug, [project.id]) .then(() => { router.push(`/${workspaceSlug}/projects/${project.id}/issues`); + projectStore.fetchProjects(workspaceSlug); handleClose(); }) .finally(() => {