import ObjectSelect, { ObjectSelectProps } from "../ObjectSelect/ObjectSelect.tsx"; import { FC, useEffect, useState } from "react"; import { BoardSchema, StatusSchema } from "../../client"; type OtherProps = { board: BoardSchema | null; } type SelectProps = Omit, "data" | "getLabelFn" | "getValueFn">; type Props = OtherProps & SelectProps; const DealStatusSelect: FC = ({ board, ...props}) => { const [isInitial, setIsInitial] = useState(true); const filteredData = board?.dealStatuses.filter( status => !status.isDeleted, ) ?? []; const onClear = () => props.onChange(null); useEffect(() => { if (isInitial) { setIsInitial(false); } else { onClear(); } }, [board?.id]); return ( ); }; export default DealStatusSelect;