From 492b7ac32e4a751f07fcacdf88393fb55f1c0ab5 Mon Sep 17 00:00:00 2001 From: AlexSserb Date: Tue, 2 Sep 2025 19:48:22 +0400 Subject: [PATCH] fix: fixed status select when deal form cleared --- .../DealEditorDrawer/tabs/GeneralTab/GeneralTab.tsx | 4 ++++ .../DealsTableFiltersModal/DealsTableFiltersModal.tsx | 1 + src/components/selects/StatusSelect/StatusSelect.tsx | 8 +++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/GeneralTab.tsx b/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/GeneralTab.tsx index bd3ca38..101e4aa 100644 --- a/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/GeneralTab.tsx +++ b/src/app/deals/drawers/DealEditorDrawer/tabs/GeneralTab/GeneralTab.tsx @@ -51,6 +51,10 @@ const GeneralTab: FC = ({ project, deal, dealsCrud, onClose }) => { { + form.setFieldValue("board", board ?? undefined); + form.setFieldValue("status", undefined); + }} projectId={project?.id} /> )} diff --git a/src/components/selects/StatusSelect/StatusSelect.tsx b/src/components/selects/StatusSelect/StatusSelect.tsx index 862af16..e8b47c4 100644 --- a/src/components/selects/StatusSelect/StatusSelect.tsx +++ b/src/components/selects/StatusSelect/StatusSelect.tsx @@ -5,22 +5,24 @@ import ObjectSelect, { ObjectSelectProps, } from "@/components/selects/ObjectSelect/ObjectSelect"; import useStatusesList from "@/hooks/lists/useStatusesList"; -import { BoardSchema } from "@/lib/client"; +import { StatusSchema } from "@/lib/client"; type Props = Omit< - ObjectSelectProps, + ObjectSelectProps, "data" | "getLabelFn" | "getValueFn" > & { boardId?: number; + clearOnBoardChange?: boolean; }; -const StatusSelect: FC = ({ boardId, ...props }) => { +const StatusSelect: FC = ({ boardId, clearOnBoardChange, ...props }) => { const [isInitial, setIsInitial] = useState(true); const onClear = () => props.onChange(null); const { statuses } = useStatusesList({ boardId }); useEffect(() => { + if (!clearOnBoardChange) return; if (isInitial) { setIsInitial(false); } else {