diff --git a/apps/app/components/estimates/create-update-estimate-modal.tsx b/apps/app/components/estimates/create-update-estimate-modal.tsx index a8a191eca..92c32a1c2 100644 --- a/apps/app/components/estimates/create-update-estimate-modal.tsx +++ b/apps/app/components/estimates/create-update-estimate-modal.tsx @@ -41,6 +41,11 @@ export const CreateUpdateEstimateModal: React.FC = ({ handleClose, data, defaultValues, }); + const onClose = () => { + handleClose(); + reset(); + }; + const router = useRouter(); const { workspaceSlug, projectId } = router.query; @@ -62,7 +67,6 @@ export const CreateUpdateEstimateModal: React.FC = ({ handleClose, data, (prevData) => [res, ...(prevData ?? [])], false ); - handleClose(); }) .catch(() => { setToastAlert({ @@ -71,6 +75,8 @@ export const CreateUpdateEstimateModal: React.FC = ({ handleClose, data, message: "Error: Estimate could not be created", }); }); + + onClose(); }; const updateEstimate = async (formData: IEstimate) => { @@ -102,7 +108,8 @@ export const CreateUpdateEstimateModal: React.FC = ({ handleClose, data, message: "Error: Estimate could not be updated", }); }); - handleClose(); + + onClose(); }; useEffect(() => {