React Apollo Error: No more mocked responses for the query: mutation

13,562

In the official docs its stated we should add addTypename={false} to the <MockedProvider>. And when I looked at the error message I could see that the __typename was added to the query it was looking for.

Something like:

{ Error: Network error: No more mocked responses for the query: query getDog($dogId: ID!) {
  dog(dogId: $dogId) {
    name
    __typename
  }
}

So after removing addTypename={false} I got another error:

Missing field __typename in {
  "name": "dog"
}

Now when adding a __typename to my mocked response it started working.

e.g.

const mocks = [
  {
    request: {
      query: dogQuery,
      variables: {
        dogId: 1,
      },
    },
    result: {
      data: {
        dog: {
          name: 'dog',
          __typename: 'Dog',
        },
      },
    },
  },
];
Share:
13,562

Related videos on Youtube

Michal
Author by

Michal

Updated on June 04, 2022

Comments