apollo-client v4.2.4 Release Notes

Release Date: 2019-06-06 // 5 months ago

Previous changes from v2.4.1

    • mutate's refetchQueries option now allows queries to include a custom context option. This context 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 using context. 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