MCPcopy
hub / github.com/simstudioai/sim / useDebounce

Function useDebounce

apps/sim/hooks/use-debounce.ts:9–23  ·  view source on GitHub ↗
(value: T, delay: number)

Source from the content-addressed store, hash-verified

7 * @returns The debounced value
8 */
9export function useDebounce<T>(value: T, delay: number): T {
10 const [debouncedValue, setDebouncedValue] = useState<T>(value)
11
12 useEffect(() => {
13 const timer = setTimeout(() => {
14 setDebouncedValue(value)
15 }, delay)
16
17 return () => {
18 clearTimeout(timer)
19 }
20 }, [value, delay])
21
22 return debouncedValue
23}

Callers 7

LogsFunction · 0.90
FilesFunction · 0.90
TablesFunction · 0.90
KnowledgeFunction · 0.90
KnowledgeBaseFunction · 0.90
DocumentFunction · 0.90
UsageLimitFieldFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected