Skip to content

'update' is called when 'error' exists and errorPolicy is none #526

Closed
@Narretz

Description

@Narretz

If you have a config like this:

  apollo: {
    something() {
      return {
        query: MyQuery,
        fetchPolicy: 'network-only',

        variables: {
          id: this.id,
        },

        update({ something }) {
          return convert(something);
        },

        error({ graphQLErrors }) {
          console.log('error handler');
        },
      };
    },
  }

and you have graphQLErrors, then update is still called. This is unexpected, and in fact it worked as expected (update is not called) until v3.0.0-beta.10. Then in 878f966, something was changed to hide the GraphQL console error if the error() handler exists.
However, I would expect that vue-apollo respects the errorPolicy of apollo in this case, i.e. by default it's none and a graphQLError means any data is ignored. See https://www.apollographql.com/docs/react/api/react-apollo.html#graphql-config-options-errorPolicy (the docs are for react, but the code is in apollo-client. In fact, since react handles errorPolicy, I think vue-apollo should too.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions