Major Changes
-
#4478
066528aThanks @trevor-scheer! - GraphQL.js 15 and 16.0–16.10 are no longer supported peer dependencies. The supported range is^16.11.0 || ^17.0.0. GraphQL.js 16.11 fixes OneOf input validation for nullable variables and tightens input-object coercion to reject arrays, giving GraphiQL 6 a correct baseline for OneOf inputs. Upgradegraphqlbefore upgrading these packages. -
#4392
26ae143Thanks @trevor-scheer! - Remove the deprecatedlegacyClientalias fromCreateFetcherOptions. It duplicatedlegacyWsClient— passlegacyWsClientinstead.
Minor Changes
-
#4333
093cb10Thanks @trevor-scheer! - AddcreateTransportand a structuredTransportAPI for queries, mutations, subscriptions, and incremental delivery. Pass a transport through<GraphiQL transport={...}>; thetransportandfetcherprops are mutually exclusive at the type level.GraphiQLPropsis now a union. If a TypeScript wrapper usesinterface AppProps extends GraphiQLProps, replace it with a type intersection such astype AppProps = GraphiQLProps & { applicationName: string }, even when retainingfetcher. See the migration overview.When
supportedMethodsis omitted,createTransportdiscovers endpoint capabilities throughOPTIONSand theAllowheader. Queries prefer QUERY, then POST, then GET. Mutations and operations of unknown type require POST. An explicitmethodoverride applies to queries and fails if the endpoint excludes it. GET sends GraphQL parameters in the URL; POST and QUERY send a JSON body.Discovery is shared by concurrent requests and repeats when effective request headers change. If discovery fails, exceeds two seconds, or the
Allowheader is missing or malformed, the transport assumes only its initially configuredmethod(POST by default) is available. A valid advertisement containing no supported methods blocks execution. Pass a nonemptysupportedMethodsarray to skip discovery for known capabilities. Cross-origin servers must permit OPTIONS and exposeAllowthroughAccess-Control-Expose-Headers.TransportResponseexposes HTTP method, status, headers, timing, and byte sizes alongside the GraphQL result. HTTP metadata remains available when a response body is not valid JSON. Itsokfield accounts for both HTTP status and GraphQL errors.TransportRequestsupports GraphQLextensionsand an abortsignal. Subscriptions require an explicitsubscriptionClientwith aniterate(request)method, supported bygraphql-wsv6 andgraphql-sseclients.Plugins can transform outgoing requests with
onBeforeSendand observe responses or request failures withonResponseandonError, available throughuseGraphiQLPluginContext().transport. Each registration returns a cleanup function. This context field is absent when using the legacyfetcherprop.Transports can expose query method preferences through optional
setMethod,methodOverride, andsubscribe(listener)APIs. CallingsetMethod()without an argument restores automatic selection.methodOverridedistinguishes an explicit preference from Auto;Transport.methodreflects the query method, whileTransportResponse.methodreports the method actually used for an execution.subscribe(listener)notifies GraphiQL of preference and capability changes and returns an unsubscribe function. These notifications are independent of request lifecycle hooks.createTransportimplements these APIs; custom transports can omit them.createGraphiQLFetcher,Fetcher, and<GraphiQL fetcher={...}>are deprecated but remain supported. See the Transport migration guide for examples and custom transport requirements.