Apollo-client: Context is missing on MutationOptions

Created on 24 Oct 2017  路  3Comments  路  Source: apollographql/apollo-client

Intended outcome:
MutationOptions should include context and pass it to the link.

Actual outcome:
Mutations do not accept context as an argument, only queries do.

Version

FWIW, I'm currently using the following link as a workaround at the top of my link stack:

import { ApolloLink } from 'apollo-link';

export default new ApolloLink((operation, forward) => {
    if (operation.variables.myContext) {
        operation.setContext({
            ...operation.variables.myContext,
        });
        delete operation.variables.myContext;
    }
    return forward(operation);
});

Most helpful comment

Fixed in the next rc!

Also 馃憢 鉂わ笍

All 3 comments

Fixed in the next rc!

Also 馃憢 鉂わ笍

which release is this? @jbaxleyiii

Patched in 2.0.3 (https://github.com/apollographql/apollo-client/pull/2419#issuecomment-346376432)

Was this page helpful?
0 / 5 - 0 ratings