@@ -12,6 +12,7 @@ v2 includes several breaking changes and improvements over v1. The most signific
1212- [ Multipart Requests are Disabled by Default] ( #multipart-requests-are-disabled-by-default )
1313- [ Remove Mocking Plugin from built-ins] ( #remove-mocking-plugin-from-built-ins )
1414- [ Disabled Automatic Forking] ( #disabled-automatic-forking )
15+ - [ Inflight Request Deduplication] ( #inflight-request-deduplication )
1516- [ Hive Logger] ( #hive-logger )
1617- [ OpenTelemetry] ( #opentelemetry )
1718- [ Subgraph Name in Execution Request] ( #subgraph-name-in-execution-request )
@@ -124,6 +125,57 @@ You can configure forking in your `gateway.config.ts` file by using the `fork` o
124125environment variable ` FORK ` . These options allow you to specify the number of worker processes to
125126fork.
126127
128+ ## Inflight Request Deduplication
129+
130+ Hive Gateway ships with built-in inflight request deduplication. This means that if multiple
131+ requests for the same resource are made simultaneously, Hive Gateway will only send one request to
132+ the upstream service and share the response with all the original requesters.
133+
134+ Previously, you would use the suboptimal ` useDeduplicateRequest() ` plugin to achieve this
135+ functionality. The plugin has been removed in v2, and the deduplication is now built-in and enabled
136+ by default.
137+
138+ To migrate, simply remove the plugin from your configuration and you're good to go!
139+
140+ ``` diff
141+ import {
142+ defineConfig,
143+ - useDeduplicateRequest,
144+ } from '@graphql-hive/gateway'
145+
146+ export const gatewayConfig = defineConfig({
147+ - plugins: ctx => [useDeduplicateRequest(ctx)]
148+ })
149+ ```
150+
151+ If you still want to use the deprecated plugin, you need to install it separately and use it as
152+ before:
153+
154+ ``` sh
155+ npm i @graphql-hive/plugin-deduplicate-request
156+ ```
157+
158+ ``` ts
159+ import {
160+ defineConfig ,
161+ useDeduplicateRequest ,
162+ type HTTPTransportOptions , // only for typedefs, otherwise not necessary
163+ } from ' @graphql-hive/gateway'
164+ import { useDeduplicateRequest } from ' @graphql-hive/plugin-deduplicate-request'
165+
166+ export const gatewayConfig = defineConfig ({
167+ transportEntries: {
168+ ' *.http' : {
169+ options: {
170+ // disable the built in deduplication
171+ deduplicateInflightRequests: false ,
172+ } as HTTPTransportOptions ,
173+ },
174+ },
175+ plugins : ctx => [useDeduplicateRequest (ctx )]
176+ })
177+ ```
178+
127179## Hive Logger
128180
129181The Hive Logger is a new feature in v2 that provides enhanced logging capabilities. It allows you to
0 commit comments