Documentation Index
Fetch the complete documentation index at: https://bytekit.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Import
Constructor
Config options
| Property | Type | Default | Description |
|---|---|---|---|
keyGenerator | (key: string) => string | — | Custom function to normalize or transform deduplication keys |
Methods
| Method | Returns | Description |
|---|---|---|
execute<T>(key, fn, options?) | Promise<T> | Runs fn once per unique in-flight key. Concurrent calls with the same key receive the same promise. |
getStats() | DeduplicatorStats | Returns deduplication counters |
getInFlightCount() | number | Number of requests currently in progress |
clear() | void | Cancels tracking of all in-flight keys |
resetStats() | void | Resets hit counters to zero |
getStats return value
| Property | Type | Description |
|---|---|---|
deduplicatedCount | number | Number of calls that reused an existing in-flight promise |
totalRequests | number | Total number of execute calls |
Examples
Deduplicate parallel fetches
When multiple UI components mount at the same time and each requests the current user, only one network call is made.Custom key generator
Monitoring deduplication
Integration with ApiClient interceptors
Once the underlying promise settles, the next
execute call with the same key will invoke fn again. Deduplication only applies while the original call is still in flight.