Skip to content

Commit

Permalink
Mutations basic run
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoomBringer committed Jul 29, 2022
1 parent e0932b0 commit b3a130d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/core/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,8 @@ export class QueryManager<TStore> {
),

(result: FetchResult<TData>) => {
if (graphQLResultHasError(result) && errorPolicy === 'none') {
throw new ApolloError({
graphQLErrors: result.errors,
});
if (graphQLResultHasError(result) && (errorPolicy !== 'ignore')) {
return result
}

if (mutationStoreValue) {
Expand Down
7 changes: 5 additions & 2 deletions src/react/hooks/useMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@ export function useMutation<
);

return client.mutate(clientOptions).then((response) => {
const { data, errors } = response;
const { data, errors, error_network } = response;
const error =
errors && errors.length > 0
? new ApolloError({ graphQLErrors: errors })
? new ApolloError({
graphQLErrors: errors,
networkError: error_network,
})
: void 0;

if (
Expand Down

0 comments on commit b3a130d

Please sign in to comment.