CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Releases: apollographql/apollo-client
@apollo/client@4.1.0-alpha.2
f8dab9d
Compare
Minor Changes
-
#12959
556e837
Thanks @jerelmiller! - You can now provide a callback function as thecontext
option on themutate
function returned byuseMutation
. The callback function is called with the value of thecontext
option provided to theuseMutation
hook. This is useful if you'd like to merge the context object provided to theuseMutation
hook with a value provided to themutate
function.function MyComponent() { const [mutate, result] = useMutation(MUTATION, { context: { foo: true }, }); async function runMutation() { await mutate({ // sends context as { foo: true, bar: true } context: (hookContext) => ({ ...hookContext, bar: true }), }); } // ... }
Patch Changes
- #12954
1c82eaf
Thanks @jerelmiller! - Ensure an error is thrown when@stream
is detected and anincrementalDelivery
handler is not configured.
Assets 2
@apollo/client@4.0.7
a3ea1c2
Compare
Patch Changes
- #12950
5b4f36a
Thanks @jerelmiller! - Don't sendoperationType
in the payload sent byGraphQLWsLink
.
Assets 2
@apollo/client@4.1.0-alpha.1
c5d5630
Compare
Minor Changes
-
#12934
54ab6d9
Thanks @jerelmiller! - Don't set the fallback value of a@client
field tonull
when aread
function is defined. Instead theread
function will be called with anexisting
value ofundefined
to allow default arguments to be used to set the returned value.When a
read
function is not defined nor is there a defined resolver for the field, warn and set the value tonull
only in that instance. -
#12934
54ab6d9
Thanks @jerelmiller! - Add an abstractresolvesClientField
function toApolloCache
that can be used by caches to tellLocalState
if it can resolve a@client
field when a local resolver is not defined.LocalState
will emit a warning and set a fallback value ofnull
when no local resolver is defined andresolvesClientField
returnsfalse
, or isn't defined. Returningtrue
fromresolvesClientField
signals that a mechanism in the cache will set the field value. In this case,LocalState
won't set the field value.
Patch Changes
-
#12915
c97b145
Thanks @phryneas! - Create mechanism to add experimental features to Apollo Client -
#12934
54ab6d9
Thanks @jerelmiller! - EnsureLocalState
doesn't try to read from the cache when using ano-cache
fetch policy. -
#12934
54ab6d9
Thanks @jerelmiller! - Warn when using ano-cache
fetch policy without a local resolver defined.no-cache
queries do not read or write to the cache which meantno-cache
queries are silently incomplete when the@client
field value was handled by a cacheread
function.
Assets 2
@apollo/client@4.0.6
37555ce
Compare
Assets 2
@apollo/client@4.1.0-alpha.0
36e2413
Compare
Minor Changes
-
#12923
2aa31c7
Thanks @jerelmiller! - Fix an issue where deferred payloads that reteurned arrays with fewer items than the original cached array would retain items from the cached array. This change includes@stream
arrays where stream arrays replace the cached arrays. -
#12926
c7fba99
Thanks @jerelmiller! - Support the newer incremental delivery format for the@defer
directive implemented ingraphql@17.0.0-alpha.9
. Import theGraphQL17Alpha9Handler
to use the newer incremental delivery format with@defer
.import { GraphQL17Alpha9Handler } from "@apollo/client/incremental"; const client = new ApolloClient({ // ... incrementalHandler: new GraphQL17Alpha9Handler(), });
[!NOTE]
In order to use theGraphQL17Alpha9Handler
, the GraphQL server MUST implement the newer incremental delivery format. You may see errors or unusual behavior if you use the wrong handler. If you are using Apollo Router, continue to use theDefer20220824Handler
because Apollo Router does not yet support the newer incremental delivery format. -
#12918
562e219
Thanks @jerelmiller! - Add support for the@stream
directive on both theDefer20220824Handler
and theGraphQL17Alpha2Handler
.[!NOTE]
The implementations of@stream
differ in the delivery of incremental results between the different GraphQL spec versions. If you upgrading from the older format to the newer format, expect the timing of some incremental results to change.
Patch Changes
-
#12925
f538a83
Thanks @jerelmiller! - Fix an issue where callingfetchMore
with@defer
or@stream
would not rerender incremental results as they were streamed. -
#12923
01cace0
Thanks @jerelmiller! - Improve the cache data loss warning message whenexisting
orincoming
is an array.
Assets 2
@apollo/client@4.0.5
952325c
Compare
Assets 2
@apollo/client@4.0.4
b3cbb22
Compare
Patch Changes
-
#12892
db8a04b
Thanks @jerelmiller! - Prevent unhandled rejections from the promise returned by calling themutate
function from theuseMutation
hook. -
#12899
5352c12
Thanks @phryneas! - Fix an issue wheninvariant
is called by external libraries when no dev error message handler is loaded. -
#12895
71f2517
Thanks @jerelmiller! - SupportskipToken
withuseQuery
to provide a more type-safe way to skip query execution.import { skipToken, useQuery } from "@apollo/client/react"; // Use `skipToken` in place of `skip: true` for better type safety // for required variables const { data } = useQuery(QUERY, id ? { variables: { id } } : skipToken);
Note: this change is provided as a patch within the 4.0 minor version because the changes to TypeScript validation with required variables in version 4.0 made using the
skip
option more difficult. -
#12900
c0d5be7
Thanks @phryneas! - Use named exportequal
instead of default from"@wry/equality"
Assets 2
@apollo/client@4.0.3
a65f58d
Compare
Assets 2
@apollo/client@4.0.2
94ed29c
Compare
Assets 2
@apollo/client-codemod-migrate-3-to-4@1.0.2
94ed29c