Bug fix
This commit is contained in:
@@ -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<TextInputProps, 'onChange'>) {
|
||||
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)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user