Releases: apollographql/apollo-client
v3.8.8
Patch Changes
-
#11200
ae5091a21
Thanks @jerelmiller! - Enablestrict
in tsconfig for the entire project. -
#11332
291aea56b
Thanks @asvishnyakov! - Add missed reexports of MutationFetchPolicy and RefetchWritePolicy to @apollo/client/core -
#10931
e5acf910e
Thanks @phryneas! -useMutation
: also reset internal state on reset
v3.9.0-alpha.4
v3.9.0-alpha.3
Minor Changes
-
#11301
46ab032af
Thanks @alessbell! - Add multipart subscription network adapters for Relay and urqlRelay
import { createFetchMultipartSubscription } from "@apollo/client/utilities/subscriptions/relay"; import { Environment, Network, RecordSource, Store } from "relay-runtime"; const fetchMultipartSubs = createFetchMultipartSubscription( "http://localhost:4000" ); const network = Network.create(fetchQuery, fetchMultipartSubs); export const RelayEnvironment = new Environment({ network, store: new Store(new RecordSource()), });
Urql
import { createFetchMultipartSubscription } from "@apollo/client/utilities/subscriptions/urql"; import { Client, fetchExchange, subscriptionExchange } from "@urql/core"; const url = "http://localhost:4000"; const multipartSubscriptionForwarder = createFetchMultipartSubscription(url); const client = new Client({ url, exchanges: [ fetchExchange, subscriptionExchange({ forwardSubscription: multipartSubscriptionForwarder, }), ], });
Patch Changes
-
#11275
3862f9ba9
Thanks @phryneas! - Add adefaultContext
option and property onApolloClient
, e.g. for keeping track of changing auth tokens or dependency injection.This can be used e.g. in authentication scenarios, where a new token might be
generated outside of the link chain and should passed into the link chain.import { ApolloClient, createHttpLink, InMemoryCache } from "@apollo/client"; import { setContext } from "@apollo/client/link/context"; const httpLink = createHttpLink({ uri: "/graphql", }); const authLink = setContext((_, { headers, token }) => { return { headers: { ...headers, authorization: token ? `Bearer ${token}` : "", }, }; }); const client = new ApolloClient({ link: authLink.concat(httpLink), cache: new InMemoryCache(), }); // somewhere else in your application function onNewToken(newToken) { // token can now be changed for future requests without need for a global // variable, scoped ref or recreating the client client.defaultContext.token = newToken; }
-
#11297
c8c76a522
Thanks @jerelmiller! - Add an explicit return type for theuseReadQuery
hook calledUseReadQueryResult
. Previously the return type of this hook was inferred from the return value.
v3.8.7
Patch Changes
-
#11297
c8c76a522
Thanks @jerelmiller! - Add an explicit return type for theuseReadQuery
hook calledUseReadQueryResult
. Previously the return type of this hook was inferred from the return value. -
#11337
bb1da8349
Thanks @phryneas! - #11206 used the TypeScript syntaxinfer X extends Y
that was introduced in TS 4.8.
This caused some problems for some users, so we are rolling back to a more backwards-compatible (albeit slightly less performant) type.
v3.8.6
Patch Changes
-
#11291
2be7eafe3
Thanks @ArioA! - Fix a bug that allows to only callloadErrorMessages
without also callingloadDevErrorMessages
. -
#11274
b29f000f3
Thanks @jerelmiller! - Start the query ref auto dispose timeout after the initial promise has settled. This prevents requests that run longer than the timeout duration from keeping the component suspended indefinitely. -
#11289
b5894dbf0
Thanks @phryneas! -MockedProvider
: defaultconnectToDevTools
tofalse
in createdApolloClient
instance.This will prevent the mocked
ApolloClient
instance from trying to connect to the DevTools, which would start asetTimeout
that might keep running after a test has finished. -
#11206
dd2ce7687
Thanks @phryneas! -cache.modify
: Less strict types & new dev runtime warnings.
v3.9.0-alpha.2
v3.8.5
Patch Changes
-
#11266
5192cf6e1
Thanks @phryneas! - Fixes argument handling for invariant log messages. -
#11235
6cddaaf65
Thanks @phryneas! - Fix nextFetchPolicy behaviour with transformed documents by keepingoptions
reference stable when passing it through QueryManager. -
#11252
327a2abbd
Thanks @phryneas! - Fixes a race condition in asyncMap that caused issues in React Native when errors were returned in the response payload along with a data property that was null. -
#11229
c372bad4e
Thanks @phryneas! - Remove (already throwing) SuspenseCache export that should have been removed in 3.8.
v3.9.0-alpha.1
Minor Changes
- #11178
4d64a6fa2
Thanks @sebakerckhof! - Support re-using of mocks in the MockedProvider
v3.9.0-alpha.0
Minor Changes
-
#11202
7c2bc08b2
Thanks @benjamn! - PreventQueryInfo#markResult
mutation ofresult.data
and return cache data consistently whether complete or incomplete. -
#6701
8d2b4e107
Thanks @prowe! - Ability to dynamically match mocksAdds support for a new property
MockedResponse.variableMatcher
: a predicate function that accepts avariables
param. Iftrue
, thevariables
will be passed into theResultFunction
to help dynamically build a response.