@apollo/client@4.0.0-rc.2
Pre-releaseMajor Changes
-
#12742
575bf3e
Thanks @jerelmiller! - The newSetContextLink
flips theprevContext
andoperation
arguments in the callback. ThesetContext
function has remained unchanged.- new SetContextLink((operation, prevContext) => { + new SetContextLink((prevContext, operation) => { // ... })
-
#12742
575bf3e
Thanks @jerelmiller! - Theoperation
argument to the callback passed toSetContextLink
is now of typeSetContextLink.SetContextOperation
which is anOperation
without thegetContext
orsetContext
functions. Previously the type ofoperation
wasGraphQLRequest
which had access to acontext
property. Thecontext
property was alwaysundefined
and could result in bugs when using it instead of theprevContext
argument.This change means the
operation
argument now contains an accessibleclient
property.
Minor Changes
-
#12740
1c6e03c
Thanks @phryneas! - Overridable types fordataState: "complete"
,dataState: "streaming"
and
dataState: "partial"
responses.This adds the
DataValue
namespace exported from Apollo Client with the three
typesDataValue.Complete
,DataValue.Streaming
andDataValue.Partial
.These types will be used to mark
TData
in the respective states.Complete
defaults toTData
Streaming
defaults toTData
Partial
defaults toDeepPartial<TData>
All three can be overwritten, e.g. to be
DeepReadonly
using higher kinded types
by following this pattern:import { HKT, DeepPartial } from "@apollo/client/utilities"; import { DeepReadonly } from "some-type-helper-library"; interface CompleteOverride extends HKT { return: DeepReadonly<this["arg1"]>; } interface StreamingOverride extends HKT { return: DeepReadonly<this["arg1"]>; } interface PartialOverride extends HKT { return: DeepReadonly<DeepPartial<this["arg1"]>>; } declare module "@apollo/client" { export interface TypeOverrides { Complete: CompleteOverride; Streaming: StreamingOverride; Partial: PartialOverride; } }