Vize

ref-debounced

Readonly ref that follows source after it stayed quiet for waitMs.

Package @vizejs/composable/ref-debounced
Own the source vize lib pull composable:ref-debounced
Runtime exports refDebounced
Gzip budget 2304 B

Usage

import { refDebounced } from "@vizejs/composable/ref-debounced";

Runtime contract

Utility Category Stability SSR Hydration Cleanup Targets Host globals Uses
refDebounced timing experimental deterministic-fallback stable caller, reactive-scope web, server, worker, native, desktop, terminal globalThis, window useDebounced

API

refDebounced

Readonly ref that follows source after it stayed quiet for waitMs. Shorthand for useDebounced(source, waitMs, options).debounced when the pending flag and cancel/flush controls are not needed. Inherits every rule of useDebounced: synchronous mirroring on the server, reactive wait, and scope-bound cleanup.

function refDebounced<Value>( source: MaybeRefOrGetter<Value>, waitMs: MaybeRefOrGetter<number>, options: UseDebouncedOptions = {}, ): Readonly<ShallowRef<Value>>
const query = ref("");
const debouncedQuery = refDebounced(query, 300);