From 402d0dd3dbbc94a08ec26491c40096d153c53fc4 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 30 Mar 2022 18:13:15 +0200 Subject: [PATCH] Revert "refactor(react): useDeferredValue" This reverts commit cd4d7b5d36644b0fe6c29af6922aa4dd5adf41d4. --- app/javascript/components/ComboSearch.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/javascript/components/ComboSearch.tsx b/app/javascript/components/ComboSearch.tsx index 72c5816b4..28a4ea696 100644 --- a/app/javascript/components/ComboSearch.tsx +++ b/app/javascript/components/ComboSearch.tsx @@ -1,9 +1,5 @@ -import React, { - useState, - useRef, - useDeferredValue, - ChangeEventHandler -} from 'react'; +import React, { useState, useRef, ChangeEventHandler } from 'react'; +import { useDebounce } from 'use-debounce'; import { useQuery } from 'react-query'; import { Combobox, @@ -63,7 +59,7 @@ function ComboSearch({ const [, setExternalId] = useHiddenField(group, 'external_id'); const initialValue = externalValue ? externalValue : controlledValue; const [searchTerm, setSearchTerm] = useState(''); - const debouncedSearchTerm = useDeferredValue(searchTerm); + const [debouncedSearchTerm] = useDebounce(searchTerm, 300); const [value, setValue] = useState(initialValue); const resultsMap = useRef< Record