mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
Merge pull request #1966 from makeplane/fix/workspace-members-mutate
fix: workspace members mutate issue
This commit is contained in:
commit
489ef6a3cc
@ -25,6 +25,7 @@ type Props = {
|
|||||||
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
||||||
workspace_slug: string;
|
workspace_slug: string;
|
||||||
user: ICurrentUserResponse | undefined;
|
user: ICurrentUserResponse | undefined;
|
||||||
|
onSuccess: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
type EmailRole = {
|
type EmailRole = {
|
||||||
@ -45,12 +46,8 @@ const defaultValues: FormValues = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const SendWorkspaceInvitationModal: React.FC<Props> = ({
|
const SendWorkspaceInvitationModal: React.FC<Props> = (props) => {
|
||||||
isOpen,
|
const { isOpen, setIsOpen, workspace_slug, user, onSuccess } = props;
|
||||||
setIsOpen,
|
|
||||||
workspace_slug,
|
|
||||||
user,
|
|
||||||
}) => {
|
|
||||||
const {
|
const {
|
||||||
control,
|
control,
|
||||||
reset,
|
reset,
|
||||||
@ -88,6 +85,7 @@ const SendWorkspaceInvitationModal: React.FC<Props> = ({
|
|||||||
title: "Success!",
|
title: "Success!",
|
||||||
message: "Invitations sent successfully.",
|
message: "Invitations sent successfully.",
|
||||||
});
|
});
|
||||||
|
onSuccess();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
|
@ -99,6 +99,10 @@ const MembersSettings: NextPage = () => {
|
|||||||
|
|
||||||
const currentUser = workspaceMembers?.find((item) => item.member?.id === user?.id);
|
const currentUser = workspaceMembers?.find((item) => item.member?.id === user?.id);
|
||||||
|
|
||||||
|
const handleInviteModalSuccess = () => {
|
||||||
|
mutateInvitations();
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WorkspaceAuthorizationLayout
|
<WorkspaceAuthorizationLayout
|
||||||
breadcrumbs={
|
breadcrumbs={
|
||||||
@ -139,8 +143,9 @@ const MembersSettings: NextPage = () => {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
mutateMembers((prevData: any) =>
|
mutateMembers(
|
||||||
prevData?.filter((item: any) => item.id !== selectedRemoveMember)
|
(prevData: any) =>
|
||||||
|
prevData?.filter((item: any) => item.id !== selectedRemoveMember)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -180,6 +185,7 @@ const MembersSettings: NextPage = () => {
|
|||||||
setIsOpen={setInviteModal}
|
setIsOpen={setInviteModal}
|
||||||
workspace_slug={workspaceSlug as string}
|
workspace_slug={workspaceSlug as string}
|
||||||
user={user}
|
user={user}
|
||||||
|
onSuccess={handleInviteModalSuccess}
|
||||||
/>
|
/>
|
||||||
<div className="p-8">
|
<div className="p-8">
|
||||||
<SettingsHeader />
|
<SettingsHeader />
|
||||||
|
Loading…
Reference in New Issue
Block a user