Overview
The gql_dedupe_link package is a GraphQL link for Dart and Flutter that prevents duplicate in-flight requests by deduplicating identical queries or mutations. It ensures that if the same request is made multiple times before completion, only one execution occurs, with subsequent requests receiving the result from the first. This improves performance and avoids redundant network calls, especially useful in scenarios like rapid user input or repeated UI updates. The link integrates seamlessly with the gql ecosystem and supports all major platforms.
Use cases
- Preventing duplicate API calls during rapid user interactions
- Optimizing performance in real-time data fetching
- Reducing network load in high-frequency query scenarios
- Improving UX in forms with auto-save or search suggestions
- Handling race conditions in concurrent GraphQL operations
Key features
- Automatic deduplication of identical in-flight requests
- Seamless integration with gql client
- Supports queries and mutations
- Minimal configuration required
- Cross-platform compatibility
Suitable for
- Developers using gql client in Flutter apps
- Apps with frequent or repetitive GraphQL operations
- Teams prioritizing network efficiency and UX responsiveness
- Real-time or form-heavy applications
- Projects aiming to reduce redundant server load
Considerations
- May not deduplicate requests with different variables even if operation is identical
- Does not affect already completed requests
- Requires proper variable serialization for effective deduplication
- Best used with stable, predictable query structures
- Limited to deduplication within the same client instance