A Redux middleware and reducer that prevents duplicate HTTP requests by tracking in-flight requests.
redux-requests is a Redux middleware and reducer library that prevents duplicate HTTP requests by tracking in-flight requests. It solves the problem of multiple components triggering identical API calls simultaneously, which wastes bandwidth and causes unnecessary re-renders. The library automatically cancels redundant requests without requiring developers to write manual deduplication logic.
Redux developers building applications with frequent API calls, particularly those with multiple components that may request the same data simultaneously. It's especially useful for React/Redux applications where components mount independently and need shared data.
Developers choose redux-requests because it eliminates boilerplate code for request deduplication while maintaining full control over request handling. Unlike manual solutions, it integrates cleanly with Redux middleware and keeps views stateless.
Manages in-flight requests with a Redux reducer to avoid issuing duplicate requests https://idolize.github.io/redux-requests
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Prevents duplicate HTTP requests by tracking in-flight requests with a unique URL hash, eliminating the need for manual tracking logic as shown in the naive vs new code examples.
Provides `createRequestMiddleware` and `requestsReducer` that integrate directly into Redux middleware chains and state management, allowing easy adoption without major refactoring.
The `attemptRequest` function simplifies action creation by automatically adding required `meta.httpRequest` metadata, reducing repetitive code changes for common use cases.
Allows custom state selectors to locate the request reducer's state in the store, offering adaptability for different Redux store structures.
For full control beyond the helper, developers must manually add `meta.httpRequest` fields to actions, which is error-prone and adds boilerplate, as seen in the example without `attemptRequest`.
Focuses solely on request deduplication; lacks built-in caching, retry mechanisms, or advanced error handling, requiring additional libraries or custom code for comprehensive data fetching.
Tightly coupled to Redux, making it incompatible with applications using other state management systems or those transitioning away from Redux.
Requires configuring both middleware and reducer, which can complicate Redux store setup, especially in larger applications with multiple middleware layers.