From 1b1f08576fec9d282034bb950db075be9e3a2a6e Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Wed, 11 Aug 2021 14:54:39 -0400 Subject: [PATCH] Avoid voiding result.data just because diff.result incomplete. This change fixes issue #8620, by not clobbering `result.data` whenever `diff.complete` is false, but introduces other problems (test failures) that I will solve in later commits. --- src/core/ObservableQuery.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/ObservableQuery.ts b/src/core/ObservableQuery.ts index 3b339d84401..151938ac38b 100644 --- a/src/core/ObservableQuery.ts +++ b/src/core/ObservableQuery.ts @@ -202,10 +202,12 @@ export class ObservableQuery< if (!this.queryManager.transform(this.options.query).hasForcedResolvers) { const diff = this.queryInfo.getDiff(); - result.data = ( - diff.complete || - this.options.returnPartialData - ) ? diff.result : void 0; + if (diff.complete || this.options.returnPartialData) { + result.data = diff.result; + } + if (equal(result.data, {})) { + result.data = void 0 as any; + } if (diff.complete) { // If the diff is complete, and we're using a FetchPolicy that