From f2746b8b65ee724d46b40541c11076d9d9c69e7e Mon Sep 17 00:00:00 2001 From: AlexSserb Date: Sat, 13 Sep 2025 09:02:07 +0400 Subject: [PATCH] refactor: using isDirty in forms --- .../drawers/DealEditorDrawer/tabs/GeneralTab/Footer.tsx | 9 +++------ .../DealEditorDrawer/tabs/GeneralTab/GeneralTab.tsx | 3 +-- .../ProjectEditorDrawer/tabs/GeneralTab/Footer.tsx | 8 +++----- .../ProjectEditorDrawer/tabs/GeneralTab/GeneralTab.tsx | 3 +-- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/Footer.tsx b/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/Footer.tsx index a165483..e1f419f 100644 --- a/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/Footer.tsx +++ b/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/Footer.tsx @@ -1,17 +1,14 @@ import { FC } from "react"; -import { isEqual } from "lodash"; import { Button, Group } from "@mantine/core"; import { UseFormReturnType } from "@mantine/form"; import { DealForm } from "@/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/GeneralTab"; -import { DealSchema } from "@/lib/client"; type Props = { form: UseFormReturnType; - initialValues: Partial; onDelete: () => void; }; -const Footer: FC = ({ form, initialValues, onDelete }) => { +const Footer: FC = ({ form, onDelete }) => { return ( = ({ form, initialValues, onDelete }) => { diff --git a/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/GeneralTab.tsx b/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/GeneralTab.tsx index f585764..5776412 100644 --- a/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/GeneralTab.tsx +++ b/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/GeneralTab.tsx @@ -29,7 +29,7 @@ const GeneralTab: FC = ({ value, onDelete, onChange }) => { }); const onSubmit = (values: DealForm) => { - form.setInitialValues(values); + form.resetDirty(); onChange({ ...values, board: values.board!, @@ -63,7 +63,6 @@ const GeneralTab: FC = ({ value, onDelete, onChange }) => { />