Skip to content

Commit

Permalink
fix: project member mutate issue (#1967)
Browse files Browse the repository at this point in the history
  • Loading branch information
sriramveeraghanta authored Aug 24, 2023
1 parent 489ef6a commit 802e6b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions apps/app/components/project/send-project-invitation-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect } from "react";

import { useRouter } from "next/router";

import useSWR, { mutate } from "swr";
import useSWR from "swr";

import { useForm, Controller, useFieldArray } from "react-hook-form";

Expand All @@ -28,7 +28,7 @@ import useToast from "hooks/use-toast";
// types
import { ICurrentUserResponse } from "types";
// fetch-keys
import { PROJECT_MEMBERS, WORKSPACE_MEMBERS } from "constants/fetch-keys";
import { WORKSPACE_MEMBERS } from "constants/fetch-keys";
// constants
import { ROLE } from "constants/workspace";

Expand All @@ -37,6 +37,7 @@ type Props = {
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
members: any[];
user: ICurrentUserResponse | undefined;
onSuccess: () => void;
};

type member = {
Expand All @@ -57,7 +58,9 @@ const defaultValues: FormValues = {
],
};

const SendProjectInvitationModal: React.FC<Props> = ({ isOpen, setIsOpen, members, user }) => {
const SendProjectInvitationModal: React.FC<Props> = (props) => {
const { isOpen, setIsOpen, members, user, onSuccess } = props;

const router = useRouter();
const { workspaceSlug, projectId } = router.query;

Expand Down Expand Up @@ -98,13 +101,13 @@ const SendProjectInvitationModal: React.FC<Props> = ({ isOpen, setIsOpen, member
type: "success",
message: "Member added successfully",
});
onSuccess();
})
.catch((error) => {
console.log(error);
})
.finally(() => {
reset(defaultValues);
mutate(PROJECT_MEMBERS(projectId.toString()));
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ const MembersSettings: NextPage = () => {

const currentUser = projectMembers?.find((item) => item.member.id === user?.id);

const handleProjectInvitationSuccess = () => {};

return (
<ProjectAuthorizationWrapper
breadcrumbs={
Expand Down Expand Up @@ -167,6 +169,7 @@ const MembersSettings: NextPage = () => {
setIsOpen={setInviteModal}
members={members}
user={user}
onSuccess={() => mutateMembers()}
/>
<div className="p-8">
<SettingsHeader />
Expand Down

1 comment on commit 802e6b3

@vercel
Copy link

@vercel vercel bot commented on 802e6b3 Aug 24, 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 – ./apps/app

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

Please sign in to comment.