FE: invite form is reset when closed (#2875)

* feat: add the options menu

* fix: data is reset when modal is turned down

---------

Co-authored-by: Palash <palashgdev@gmail.com>
This commit is contained in:
Palash Gupta 2023-06-09 00:44:25 +05:30 committed by GitHub
parent 04a9de1e32
commit 5af5cb0cf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,12 +55,18 @@ function PendingInvitesContainer(): JSX.Element {
queryKey: ['getPendingInvites', user?.accessJwt],
});
const toggleModal = (value: boolean): void => {
setIsInviteTeamMemberModalOpen(value);
};
const [dataSource, setDataSource] = useState<DataProps[]>([]);
const toggleModal = useCallback(
(value: boolean): void => {
setIsInviteTeamMemberModalOpen(value);
if (!value) {
form.resetFields();
}
},
[form],
);
const { hash } = useLocation();
const getParsedInviteData = useCallback(
@ -79,7 +85,7 @@ function PendingInvitesContainer(): JSX.Element {
if (hash === INVITE_MEMBERS_HASH) {
toggleModal(true);
}
}, [hash]);
}, [hash, toggleModal]);
useEffect(() => {
if (
@ -225,7 +231,13 @@ function PendingInvitesContainer(): JSX.Element {
});
}
},
[getParsedInviteData, getPendingInvitesResponse, notifications, t],
[
getParsedInviteData,
getPendingInvitesResponse,
notifications,
t,
toggleModal,
],
);
return (