diff --git a/src/Components/Facility/SpokeFacilityEditor.tsx b/src/Components/Facility/SpokeFacilityEditor.tsx index 435120ca275..99a223dcebf 100644 --- a/src/Components/Facility/SpokeFacilityEditor.tsx +++ b/src/Components/Facility/SpokeFacilityEditor.tsx @@ -78,7 +78,8 @@ export default function SpokeFacilityEditor(props: SpokeFacilityEditorProps) { setItem: (item: FacilitySpokeModel | FacilitySpokeRequest) => void, processing: boolean, ) => { - const [selectedFacility, setSelectedFacility] = useState(); + const [selectedFacility, setSelectedFacility] = + useState(null); useEffect(() => { setItem({ ...item, spoke: selectedFacility?.id }); @@ -99,8 +100,7 @@ export default function SpokeFacilityEditor(props: SpokeFacilityEditorProps) { showNOptions={8} selected={selectedFacility} setSelected={(v) => - (v === undefined || (!Array.isArray(v) && v)) && - setSelectedFacility(v) + (v === null || (!Array.isArray(v) && v)) && setSelectedFacility(v) } errors="" className="w-full" diff --git a/src/Components/Form/AutoCompleteAsync.tsx b/src/Components/Form/AutoCompleteAsync.tsx index 4d8195ae122..19ee4f2a08a 100644 --- a/src/Components/Form/AutoCompleteAsync.tsx +++ b/src/Components/Form/AutoCompleteAsync.tsx @@ -92,7 +92,7 @@ const AutoCompleteAsync = (props: Props) => { return (
0 ? selected : null} + value={selected} disabled={disabled} onChange={onChange} by={compareBy} @@ -100,7 +100,7 @@ const AutoCompleteAsync = (props: Props) => { immediate >
-
+
{ className="h-4 w-4 text-secondary-800 transition-colors duration-200 ease-in-out hover:text-secondary-500" onClick={(e) => { e.preventDefault(); - onChange(undefined); + onChange(null); }} />