Releases: apollographql/apollo-client
@apollo/client@4.0.0-rc.4
v3.14.0-rc.0
Minor Changes
- #12763
5de6a3d
Thanks @jerelmiller! - Version bump only to release latest asrc
.
v3.14.0-alpha.1
Minor Changes
-
#12752
8b779b4
Thanks @jerelmiller! - Add deprecations and warnings to remaining APIs changed in Apollo Client 4.0. -
#12751
567cad8
Thanks @jerelmiller! - Add@deprecated
tags to all properties returned from any query API (e.g.client.query
,observableQuery.refetch
, etc.),client.mutate
, andclient.subscribe
that are no longer available in Apollo Client 4.0. -
#12751
567cad8
Thanks @jerelmiller! - Warn when using astandby
fetch policy withclient.query
.
@apollo/client@4.0.0-rc.3
Major Changes
-
#12731
0198870
Thanks @phryneas! - Ship React Compiler compiled React hooks in@apollo/client/react/compiled
.We now ship a React-Compiler compiled version of the React hooks in
@apollo/client/react/compiled
.This entry point contains everything that
@apollo/client/react
does,
so you can use it as a drop-in replacement in your whole application
if you choose to use the compiled hooks.
Minor Changes
- #12753
b85818d
Thanks @jerelmiller! - Renamedclient.reFetchObservableQueries
toclient.refetchObservableQueries
.
client.reFetchObservableQueries
is still available as an alias, but is now
deprecated and will be removed in a future major version.
v3.14.0-alpha.0
Minor Changes
-
#12746
0bcd2f4
Thanks @jerelmiller! - Add warnings and deprecations for options and methods for all React APIs. -
#12746
0bcd2f4
Thanks @jerelmiller! - AddpreloadQuery.toPromise(queryRef)
as a replacement forqueryRef.toPromise()
.queryRef.toPromise()
has been removed in Apollo Client 4.0 in favor ofpreloadQuery.toPromise
and is now considered deprecated. -
#12736
ea89440
Thanks @jerelmiller! - Add deprecations and deprecation warnings forApolloClient
options and methods. -
#12459
1c5a031
Thanks @jerelmiller! - ResetaddTypenameTransform
andfragments
caches when callingcache.gc()
only whenresetResultCache
istrue
. -
#12743
92ad409
Thanks @jerelmiller! - Add deprecations and warnings foraddTypename
inInMemoryCache
andMockedProvider
. -
#12743
92ad409
Thanks @jerelmiller! - Add deprecations and warnings forcanonizeResults
.
Patch Changes
@apollo/client@4.0.0-rc.2
Major 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; } }
Patch Changes
@apollo/client-codemod-migrate-3-to-4@1.0.0-rc.0
Major Changes
-
#12727
b845906
Thanks @jerelmiller! - Add a codemod that renames old import locations from 3.x entrypoint to their 4.x entrypoint.Run the codemod using the following command:
npx @apollo/client-codemod-migrate-3-to-4 --parser tsx ./src/**/*.{ts,tsx}
The codemod supports
.js
,.jsx
,.ts
, and.tsx
files.
@apollo/client@4.0.0-rc.1
Major Changes
-
#12735
5159880
Thanks @jerelmiller! - Remove deprecatedresultCacheMaxSize
option fromInMemoryCache
options. -
#12735
5159880
Thanks @jerelmiller! - Remove deprecatedconnectToDevtools
option fromApolloClientOptions
. Usedevtools.enabled
instead.
Minor Changes
-
#12725
89ac725
Thanks @jerelmiller! - AddoperationType
tooperation
inApolloLink
. This means that determining whether aquery
is a specific operation type can now be compared with this property instead of usinggetMainDefinition
.- import { getMainDefinition } from "@apollo/client/utilities"; + import { OperationTypeNode } from "graphql"; ApolloLink.split( - ({ query }) => { - const definition = getMainDefinition(query); - return ( - definition.kind === 'OperationDefinition' && - definition.operation === 'subscription' - ); - return - }, + ({ operationType }) => { + return operationType === OperationTypeNode.SUBSCRIPTION; + }, conditionTrueLink, conditionFalseLink, );
Patch Changes
-
#12728
07a0c8c
Thanks @jerelmiller! - Export theIgnoreModifier
type from@apollo/client/cache
. -
#12735
5159880
Thanks @jerelmiller! - Change theunsafePreviousData
argument onUpdateQueryMapFn
andSubscribeToMoreQueryFn
to aDeepPartial
since the result may contain partial data. -
#12734
037979d
Thanks @jerelmiller! - Don't warn about a missing resolver if a@client
does not have a configured resolver. It is possible the cache contains aread
function for the field and the warning added confusion.Note that
read
functions without a defined resolver will receive theexisting
argument asnull
instead ofundefined
even when data hasn't been written to the cache. This is becauseLocalState
sets a default value ofnull
when a resolver is not defined to ensure that the field contains a value in case aread
function is not defined rather than omitting the field entirely. -
#12725
89ac725
Thanks @jerelmiller! - ExportgetMainDefinition
from@apollo/client/utilities
. -
#12729
699c830
Thanks @jerelmiller! - EnsureuseQuery
rerenders whennotifyOnNetworkStatusChange
isfalse
and arefetch
that changes variables returns a result deeply equal to previous variables.
@apollo/client-graphql-codegen@1.0.0-rc.0
Major Changes
- #12723
1f9ed72
Thanks @jerelmiller! - Version bump only for codegen to release asrc
.
@apollo/client@4.0.0-rc.0
Major Changes
- #12718
ecfc02a
Thanks @jerelmiller! - Version bump only to release latest asrc
.