Skip to content

Commit

Permalink
Compare entire result objects in isDifferentFromLastResult. (#6120)
Browse files Browse the repository at this point in the history
Fixes #6106, as confirmed using @huchenme's excellent reproduction
(https://codesandbox.io/s/client-3-hook-0r52i), because we are no longer
skipping the comparison of properties like this.lastResultSnapshot.loading
and newResult.loading.
  • Loading branch information
benjamn committed Apr 7, 2020
1 parent 963b7c2 commit 7c9afe0
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/core/ObservableQuery.ts
Expand Up @@ -213,13 +213,7 @@ export class ObservableQuery<
// Compares newResult to the snapshot we took of this.lastResult when it was
// first received.
public isDifferentFromLastResult(newResult: ApolloQueryResult<TData>) {
const { lastResultSnapshot: snapshot } = this;
return !(
snapshot &&
newResult &&
snapshot.networkStatus === newResult.networkStatus &&
equal(snapshot.data, newResult.data)
);
return !equal(this.lastResultSnapshot, newResult);
}

// Returns the last result that observer.next was called with. This is not the same as
Expand Down

0 comments on commit 7c9afe0

Please sign in to comment.