#11086 0264fee06
Thanks @jerelmiller! - Fix an issue where a call to refetch
, fetchMore
, or changing skip
to false
that returned a result deeply equal to data in the cache would get stuck in a pending state and never resolve.
#11053 c0ca70720
Thanks @phryneas! - Add SuspenseCache
as a lazy hidden property on ApolloClient.
This means that SuspenseCache
is now an implementation details of Apollo Client and you no longer need to manually instantiate it and no longer need to pass it into ApolloProvider
. Trying to instantiate a SuspenseCache
instance in your code will now throw an error.
#11115 78739e3ef
Thanks @phryneas! - Enforce export type
for all type-level exports.
#11027 e47cfd04e
Thanks @phryneas! - Prevents the DevTool installation warning to be turned into a documentation link.
#10594 f221b5e8f
Thanks @phryneas! - Add a suspenseCache
option to useSuspenseQuery
#10700 12e37f46f
Thanks @jerelmiller! - Add a queryKey
option to useSuspenseQuery
that allows the hook to create a unique subscription instance.
#10724 e285dfd00
Thanks @jerelmiller! - Automatically strips __typename
fields from variables
sent to the server when using HttpLink
, BatchHttpLink
, or GraphQLWsLink
. This allows GraphQL data returned from a query to be used as an argument to a subsequent GraphQL operation without the need to strip the __typename
in user-space.
#10957 445164d21
Thanks @phryneas! - Use React.version
as key for shared Contexts.
#10635 7df51ee19
Thanks @jerelmiller! - Fix an issue where cache updates would not propagate to useSuspenseQuery
while in strict mode.
#11013 5ed2cfdaf
Thanks @alessbell! - Make private fields inFlightLinkObservables
and fetchCancelFns
protected in QueryManager in order to make types available in @apollo/experimental-nextjs-app-support
package when extending the ApolloClient
class.
#10869 ba1d06166
Thanks @phryneas! - Ensure Context value stability when rerendering ApolloProvider with the same client
and/or suspenseCache
prop
#11103 e3d611daf
Thanks @caylahamann! - Fixes a bug in useMutation
so that onError
is called when an error is returned from the request with errorPolicy
set to 'all' .
#10657 db305a800
Thanks @jerelmiller! - Return networkStatus
in the useSuspenseQuery
result.
#10937 eea44eb87
Thanks @jerelmiller! - Moves DocumentTransform
to the utilities
sub-package to avoid a circular dependency between the core
and cache
sub-packages.
#10951 2e833b2ca
Thanks @alessbell! - Improve useBackgroundQuery
type interface
#10651 8355d0e1e
Thanks @jerelmiller! - Fixes an issue where useSuspenseQuery
would not respond to cache updates when using a cache-first fetchPolicy
after the hook was mounted with data already in the cache.
#11026 b8d405eee
Thanks @phryneas! - Store React.Context instance mapped by React.createContext instance, not React.version.
Using React.version
can cause problems with preact
, as multiple versions of preact
will all identify themselves as React 17.0.2
.
#11000 1d43ab616
Thanks @phryneas! - Use import * as React
everywhere. This prevents an error when importing @apollo/client
in a React Server component. (see #10974)
#10852 27fbdb3f9
Thanks @phryneas! - Chore: Add ESLint rule for consistent type imports, apply autofix
#10999 c1904a78a
Thanks @phryneas! - Fix a bug in QueryReference
where this.resolve
or this.reject
might be executed even if undefined
.
#10940 1d38f128f
Thanks @jerelmiller! - Add support for the skip
option in useBackgroundQuery
and useSuspenseQuery
. Setting this option to true
will avoid a network request.
#10672 932252b0c
Thanks @jerelmiller! - Fix the compatibility between useSuspenseQuery
and React's useDeferredValue
and startTransition
APIs to allow React to show stale UI while the changes to the variable cause the component to suspend.
Breaking change
nextFetchPolicy
support has been removed from useSuspenseQuery
. If you are using this option, remove it, otherwise it will be ignored.
#10964 f33171506
Thanks @alessbell! - Fixes a bug in BatchHttpLink
that removed variables from all requests by default.
#10633 90a06eeeb
Thanks @benjamn! - Fix type policy inheritance involving fuzzy possibleTypes
#10754 64b304862
Thanks @sincraianul! - Fix includeUnusedVariables
option not working with BatchHttpLink
#11018 5618953f3
Thanks @jerelmiller! - useBackgroundQuery
now uses its own options type called BackgroundQueryHookOptions
rather than reusing SuspenseQueryHookOptions
.
#11035 a3ab7456d
Thanks @jerelmiller! - Incrementally re-render deferred queries after calling refetch
or setting skip
to false
to match the behavior of the initial fetch. Previously, the hook would not re-render until the entire result had finished loading in these cases.
#10399 652a1ae08
Thanks @alessbell! - Silence useLayoutEffect warning when useSuspenseQuery runs on server
#10919 f796ce1ac
Thanks @jerelmiller! - Fix an issue when using a link that relied on operation.getContext
and operation.setContext
would error out when it was declared after the removeTypenameFromVariables
link.
#10968 b102390b2
Thanks @phryneas! - Use printed query for query deduplication. Cache print
calls for GraphQL documents to speed up repeated operations.
#11071 4473e925a
Thanks @jerelmiller! - #10509 introduced some helpers for determining the type of operation for a GraphQL query. This imported the OperationTypeNode
from graphql-js which is not available in GraphQL 14. To maintain compatibility with graphql-js v14, this has been reverted to use plain strings.
#10766 ffb179e55
Thanks @jerelmiller! - More robust typings for the data
property returned from useSuspenseQuery
when using returnPartialData: true
or an errorPolicy
of all
or ignore
. TData
now defaults to unknown
instead of any
.
#10401 3e5b41a75
Thanks @jerelmiller! - Always throw network errors in useSuspenseQuery
regardless of the set errorPolicy
.
#10877 f40248598
Thanks @phryneas! - Change an import in useQuery
and useMutation
that added an unnecessary runtime dependency on @apollo/client/core
. This drastically reduces the bundle size of each the hooks.
#10656 54c4d2f3c
Thanks @jerelmiller! - Ensure refetch
, fetchMore
, and subscribeToMore
functions returned by useSuspenseQuery
are referentially stable between renders, even as data
is updated.
#10324 95eb228be
Thanks @jerelmiller! - Add @defer
support to useSuspenseQuery
.
#10888 1562a2f5a
Thanks @alessbell! - Updates dependency versions in package.json
by bumping:
@wry/context
to ^0.7.3
@wry/equality
to ^0.5.6
@wry/trie
to ^0.4.3
optimism
to ^0.17.4
to 1. fix sourcemap warnings and 2. a Codesandbox sandpack (in-browser) bundler transpilation bug with an upstream optimism workaround.
#11010 1051a9c88
Thanks @alessbell! - Hide queryRef in a Symbol in useBackgroundQuery
s return value.
#10758 9def7421f
Thanks @phryneas! - use React.use
where available
#11032 6a4da900a
Thanks @jerelmiller! - Throw errors in useSuspenseQuery
for errors returned in incremental chunks when errorPolicy
is none
. This provides a more consistent behavior of the errorPolicy
in the hook.
Potentially breaking change
Previously, if you issued a query with @defer
and relied on errorPolicy: 'none'
to set the error
property returned from useSuspenseQuery
when the error was returned in an incremental chunk, this error is now thrown. Switch the errorPolicy
to all
to avoid throwing the error and instead return it in the error
property.
#10960 ee407ef97
Thanks @alessbell! - Adds support for returnPartialData
and refetchWritePolicy
options in useBackgroundQuery
hook.
#10809 49d28f764
Thanks @jerelmiller! - Fixed the ability to use refetch
and fetchMore
with React's startTransition
. The hook will now behave correctly by allowing React to avoid showing the Suspense fallback when these functions are wrapped by startTransition
. This change deprecates the suspensePolicy
option in favor of startTransition
.
#11082 0f1cde3a2
Thanks @phryneas! - Restore Apollo Client 3.7 getApolloContext
behaviour
#10969 525a9317a
Thanks @phryneas! - Slightly decrease bundle size and memory footprint of SuspenseCache
by changing how cache entries are stored internally.
#11025 6092b6edf
Thanks @jerelmiller! - useSuspenseQuery
and useBackgroundQuery
will now properly apply changes to its options between renders.
#10872 96b4f8837
Thanks @phryneas! - The "per-React-Version-Singleton" ApolloContext is now stored on globalThis
, not React.createContext
, and throws an error message when accessed from React Server Components.
#10450 f8bc33387
Thanks @jerelmiller! - Add support for the subscribeToMore
and client
fields returned in the useSuspenseQuery
result.