Improve response filter UX

This commit is contained in:
Gregory Schier
2024-01-15 15:19:29 -08:00
parent 13307a76af
commit b0e1614aac
2 changed files with 12 additions and 7 deletions

View File

@@ -5,8 +5,8 @@ import { debounce } from '../lib/debounce';
export function useDebouncedSetState<T>(
defaultValue: T,
delay?: number,
): [T, Dispatch<SetStateAction<T>>] {
): [T, Dispatch<SetStateAction<T>>, Dispatch<SetStateAction<T>>] {
const [state, setState] = useState<T>(defaultValue);
const debouncedSetState = useMemo(() => debounce(setState, delay), [delay]);
return [state, debouncedSetState];
return [state, debouncedSetState, setState];
}