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