useDebounce
Debounce or throttle a reactive value, so an expensive reaction (an API call, a filter over thousands of rows) runs once the input settles. Timers stop with the component: nothing is written after unmount.
Install: pnpm add-composable useDebounce
Debounced search
Delay reacting to input until the user stops typing.
API
useDebounce(<T>(source: Ref<T>, delay?: number) => DebouncedRef<T>): A ref that updates delay ms after the source stops changing.flush(() => void): On the debounced ref. Apply the pending value now, e.g. on Enter.cancel(() => void): On the debounced ref. Drop the pending value, e.g. when a dialog closes.useThrottle(<T>(source: Ref<T>, interval?: number) => Readonly<Ref<T>>): A ref that updates at most once every interval ms, with a trailing update.