Skip to content

Commit

Permalink
bring back the old errors to error behavior in useQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
brainkim committed Aug 6, 2021
1 parent 5ce8bb9 commit 644f623
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/react/hooks/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@ export function useQuery<
error: void 0,
networkStatus: NetworkStatus.ready,
};
} else if (result.errors && result.errors.length) {
// Until a set naming convention for networkError and graphQLErrors is
// decided upon, we map errors (graphQLErrors) to the error options.
// TODO: Is it possible for both result.error and result.errors to be defined here?
result = {
...result,
error: result.error || new ApolloError({ graphQLErrors: result.errors }),
};
}

// TODO: Is this still necessary?
Expand Down

0 comments on commit 644f623

Please sign in to comment.