Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Fix batch fetch result on error #636

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/apollo-link-batch-http/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change log

### vNext
- Fix batch link result on error

### 1.2.2
- Update apollo-link [#559](https://github.com/apollographql/apollo-link/pull/559)
Expand Down
6 changes: 5 additions & 1 deletion packages/apollo-link-batch-http/src/batchHttpLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ export class BatchHttpLink extends ApolloLink {
// to pass to UI
// this should only happen if we *also* have data as part of the response key per
// the spec
if (err.result && err.result.errors && err.result.data) {
if (
err.result &&
Array.isArray(err.result) &&
err.result.some(i => i.data && i.errors)
) {
// if we dont' call next, the UI can only show networkError because AC didn't
// get andy graphqlErrors
// this is graphql execution result info (i.e errors and possibly data)
Expand Down