A simple library to deduplicate identical axios requests in-flight. Current stable version is 1.2.0, released infrequently. It intercepts requests and, if a duplicate request is detected within a configurable time window, returns the same Promise instead of making a new HTTP call. Supports custom request key generation, skip logic, and timeout. Ships TypeScript types. Lightweight alternative to more complex caching solutions.
npm install axios-deduplicatorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic setup with axios interceptors to deduplicate identical requests. Demonstrates that the second request reuses the same Promise.
Use axiosDeduplicator.requestInterceptor.bind(axiosDeduplicator) or use the factory function.
For previous behavior (only dedup while first is pending), set repeatWindowMs to 0.
Use function skip(config, res, error) as shown in the README, not the doc order.
Assert types as needed: (config as any).headers.
Ensure createAxiosDeduplicatorInstance() is called: const dedup = createAxiosDeduplicatorInstance();
Bind methods: axiosDeduplicator.requestInterceptor.bind(axiosDeduplicator)
Check that createAxiosDeduplicatorInstance returns an object with all three interceptors.