diff --git a/src/inputs/internal/ComboBoxBase.tsx b/src/inputs/internal/ComboBoxBase.tsx index 396cd79f3..9948730c1 100644 --- a/src/inputs/internal/ComboBoxBase.tsx +++ b/src/inputs/internal/ComboBoxBase.tsx @@ -312,6 +312,11 @@ export function ComboBoxBase(props: ComboBoxBaseProps) const [debouncedSearch] = useDebounce(searchValue, 300); + useEffect(() => { + if (!debouncedSearch || !onAddNew) return; + if (filteredOptions.length === 1 && filteredOptions[0] === addNewOption) onAddNew(debouncedSearch); + }, [debouncedSearch, filteredOptions, onAddNew]); + // Reset inputValue when closed or selected changes useEffect(() => { if (state.isOpen && multiselect) {