This commit is contained in:
Sean Edmunds
2026-01-09 13:11:36 -06:00
parent 924b42a567
commit f92ee29dfa

View File

@@ -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)}
/>
);
}