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 { TextInput, type TextInputProps } from '@mantine/core';
import { useEffect, useState } from 'react'; import { useEffect } from 'react';
export function DebouncedInput({ export function DebouncedInput({
value: initialValue, value,
onChange, onChange,
debounce = 500, debounce = 500,
...props ...props
@@ -11,8 +11,6 @@ export function DebouncedInput({
onChange: (value: string | number) => void; onChange: (value: string | number) => void;
debounce?: number; debounce?: number;
} & Omit<TextInputProps, 'onChange'>) { } & Omit<TextInputProps, 'onChange'>) {
const [value, setValue] = useState(initialValue);
useEffect(() => { useEffect(() => {
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
onChange(value); onChange(value);
@@ -26,7 +24,7 @@ export function DebouncedInput({
{...props} {...props}
value={value} value={value}
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
onChange={(e) => setValue(e.target.value)} onChange={(e) => onChange(e.target.value)}
/> />
); );
} }