kinetex - v1.0.0-rc.1
    Preparing search index...

    Interface DedupOptions

    In-flight request deduplication (coalescing) for kinetex.

    When multiple callers make identical concurrent requests (same method + URL + headers), dedup coalesces them into a single network call and fans the result out to all waiters. This prevents thundering-herd patterns in React renders, parallel service calls, and CDN misses.

    Features:

    • Key-based deduplication (fully customizable key function)
    • Configurable TTL: response cached briefly so slightly-staggered calls (within windowMs) also hit the coalesced result
    • Cancellation: if the "leader" request is aborted, waiters fall through to their own requests automatically
    • Error propagation: errors are shared across all waiting callers
    • Metrics: hit count, miss count, in-flight map
    • Zero dependencies, cross-runtime
    interface DedupOptions {
        keyFn?: (
            method: string,
            url: string,
            headers?: Record<string, string>,
        ) => string;
        windowMs?: number;
        methods?: string[];
        signal?: AbortSignal;
    }
    Index

    Properties

    keyFn?: (
        method: string,
        url: string,
        headers?: Record<string, string>,
    ) => string

    Custom key function. Receives the method and URL. Default: "${method}::${url}"

    windowMs?: number

    How long (ms) to keep a completed response in the window so that requests arriving just after completion still coalesce. Default: 0 (disabled — only in-flight requests are deduplicated)

    methods?: string[]

    HTTP methods to deduplicate. Default: ["GET", "HEAD"] Only safe idempotent methods should be deduplicated. Note: Methods are case-insensitive (converted to uppercase internally).

    signal?: AbortSignal

    Global abort signal for the dedup map. When aborted, in-flight entries are cleaned up and new calls fall through to factory(). Note: Pass per-request signals to execute() instead for finer control.