diff --git a/src/components/DebouncedInput.tsx b/src/components/DebouncedInput.tsx index d2dbf7f..fb66472 100644 --- a/src/components/DebouncedInput.tsx +++ b/src/components/DebouncedInput.tsx @@ -1,8 +1,8 @@ import { TextInput, type TextInputProps } from '@mantine/core'; -import { useEffect, useState } from 'react'; +import { useEffect } from 'react'; export function DebouncedInput({ - value: initialValue, + value, onChange, debounce = 500, ...props @@ -11,8 +11,6 @@ export function DebouncedInput({ onChange: (value: string | number) => void; debounce?: number; } & Omit) { - const [value, setValue] = useState(initialValue); - useEffect(() => { const timeout = setTimeout(() => { onChange(value); @@ -26,7 +24,7 @@ export function DebouncedInput({ {...props} value={value} onClick={(e) => e.stopPropagation()} - onChange={(e) => setValue(e.target.value)} + onChange={(e) => onChange(e.target.value)} /> ); }