apollo-client v2.4.1 Release Notes
Release Date: 2018-08-26 // over 5 years ago-
mutate
'srefetchQueries
option now allows queries to include a customcontext
option. Thiscontext
will be used when refetching the query. For example:
context = { headers: { token: 'some auth token', }, }; client.mutate({ mutation: UPDATE_CUSTOMER_MUTATION, variables: { userId: user.id, firstName, ... }, refetchQueries: [{ query: CUSTOMER_MESSAGES_QUERY, variables: { userId: user.id }, context, }], context, });
The
CUSTOMER_MESSAGES_QUERY
above will be refetched usingcontext
. Normally queries are refetched using the original context they were first started with, but this provides a way to override the context, if needed. @hwillson in #3852