diff --git a/src/components/inputs/Autocomplete/Autocomplete.tsx b/src/components/inputs/Autocomplete/Autocomplete.tsx index a362e76e..a89b4e00 100644 --- a/src/components/inputs/Autocomplete/Autocomplete.tsx +++ b/src/components/inputs/Autocomplete/Autocomplete.tsx @@ -277,8 +277,10 @@ const Autocomplete: React.FC> = ({ if (event?.nativeEvent?.type === 'focusout') { return } + + await handleLoadOptions(value) }, - [onInputChange] + [handleLoadOptions, onInputChange] ) useEffect(() => { @@ -325,7 +327,12 @@ const Autocomplete: React.FC> = ({ return simpleValue ? getSimpleValue(loadOptions ? asyncOptions : options, value, valueKey, isMultiSelection) : value }, [simpleValue, loadOptions, asyncOptions, options, value, valueKey, isMultiSelection]) - const throttledOnInputChange = useRef(throttle(handleInputChange, 500)).current + const inputChangeRef = useRef(throttle(handleInputChange, 500)) + const throttledOnInputChange = inputChangeRef.current + + useEffect(() => { + inputChangeRef.current = throttle(handleInputChange, 500) + }, [handleInputChange]) return (