graffle-js/graffle

Mutation does not return "errors" object array in latest v7.x

Closed this issue · 1 comments

Before writing this issue, I combed through the docs trying to find a migration guide from v6.x to v7.x but I was not able to find something related to my issue described here

Description

Mutations are not returning (mapping) the errors object array in the response when submitting a form and the backend API returns field validation errors.

I have put together the error responses from v6.1.0 vs v7.x in the bare-bones repo I created for this issue: https://github.com/esausilva/repro-graphql-request/blob/master/error-response.md

In the response from v6.x you see the errors object array missing from the response in v7.x. Also, notice the headers object is empty from the v7.x response.

When I take a look at the Network Tab in the Developer Tools, for both versions I see the same response with the errors object in it, as seen in this screenshot https://github.com/esausilva/repro-graphql-request/blob/master/network-tab.jpg

I am using React Query. In index.tsx, line 58 (https://github.com/esausilva/repro-graphql-request/blob/master/src/pages/index.tsx) where the onError callback executes, the error parameter should include the errors object seen here v.6x

    onError: (error: GraphQLErrorResponse) => {
      console.log(' ~ error:', error);
    },

Reproduction Steps/Repo Link

https://github.com/esausilva/repro-graphql-request/

The code in the repo will not fully run as I have the API in .NET Core, however, that is exactly how I have the front-end setup.

Other than updating to the latest version, the setup has not changed.

Hey, thanks for the issue. Take a look at this: #1113.