diff --git a/app/javascript/components/ComboSearch.tsx b/app/javascript/components/ComboSearch.tsx index 9bdedc397..f3abd6a94 100644 --- a/app/javascript/components/ComboSearch.tsx +++ b/app/javascript/components/ComboSearch.tsx @@ -1,5 +1,9 @@ -import React, { useState, useRef, ChangeEventHandler } from 'react'; -import { useDebounce } from 'use-debounce'; +import React, { + useState, + useRef, + useDeferredValue, + ChangeEventHandler +} from 'react'; import { useQuery } from 'react-query'; import { Combobox, @@ -59,7 +63,7 @@ function ComboSearch({ const [, setExternalId] = useHiddenField(group, 'external_id'); const initialValue = externalValue ? externalValue : controlledValue; const [searchTerm, setSearchTerm] = useState(''); - const [debouncedSearchTerm] = useDebounce(searchTerm, 300); + const debouncedSearchTerm = useDeferredValue(searchTerm); const [value, setValue] = useState(initialValue); const resultsMap = useRef< Record