Skip to content

Commit

Permalink
Make ObservableQuery.lastResult keep track of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonpaulos committed Aug 2, 2019
1 parent 042f29b commit ca3230c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/apollo-client/src/core/ObservableQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,14 @@ export class ObservableQuery<
}

const onError = (error: ApolloError) => {
// Since we don't get the current result on errors, only the error, we
// must mirror the updates that occur in QueryStore.markQueryError here
this.updateLastResult({
...this.lastResult,
errors: error.graphQLErrors,
networkStatus: NetworkStatus.error,
loading: false,
});
iterateObserversSafely(this.observers, 'error', this.lastError = error);
};

Expand Down

0 comments on commit ca3230c

Please sign in to comment.