function useAsyncDebouncedCallback<TFn>(fn, options): (...args) => Promise<Awaited<ReturnType<TFn>> | undefined>;Defined in: async-debouncer/useAsyncDebouncedCallback.ts:37
Returns a stable debounced callback owned by the Octane lifecycle.
With the default trailing behavior, each call restarts the wait timer and only the latest pending update executes. Leading and trailing options control the edges.
Returns the bound maybeExecute method with the wrapped function's parameter types. The returned Promise preserves the core result and error contract. A replaced trailing call resolves with the previous lastResult; it does not wait for the newer call.
Use useAsyncDebouncer when you need selected state or control methods. This callback does not expose the utility, its store, or a child subscription.
Call during component rendering. The hook retains its utility across renders and runs cleanup when the component unmounts. Options accept an object with top-level getters or an options factory. Function-valued core options remain callbacks. Local options override provider defaults without replacing the utility or its pending work. onUnmount replaces default cleanup and receives the utility instance. A custom callback must perform every needed cancel, stop, or abort action.
TFn extends AnyAsyncFunction
TFn
OctanePacerOptions<OctaneAsyncDebouncerOptions<TFn, { }>>
(...args): Promise<Awaited<ReturnType<TFn>> | undefined>;Attempts to execute the debounced function. If a call is already in progress, it will be queued.
Error Handling:
...Parameters<TFn>
Promise<Awaited<ReturnType<TFn>> | undefined>
A promise that resolves with the function's return value, or undefined if an error occurred and was handled by onError
The error from the debounced function if no onError handler is configured
import { useAsyncDebouncedCallback } from '@tanstack/octane-pacer'
// During component rendering:
const schedule = useAsyncDebouncedCallback(async (value: number) => { console.log(value) }, { wait: 500 })
void schedule(1)useAsyncDebouncer