From 1481bbb15d1f9c233693c35907aef15f80b8b991 Mon Sep 17 00:00:00 2001 From: Gary Mardell Date: Wed, 20 Nov 2024 11:39:08 -0800 Subject: [PATCH] api-client-core should propagate error for live queries --- packages/api-client-core/package.json | 2 +- .../createApplyLiveQueryPatch.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/api-client-core/package.json b/packages/api-client-core/package.json index b4469435e..103f60d7d 100644 --- a/packages/api-client-core/package.json +++ b/packages/api-client-core/package.json @@ -1,6 +1,6 @@ { "name": "@gadgetinc/api-client-core", - "version": "0.15.34", + "version": "0.15.35", "files": [ "Readme.md", "dist/**/*" diff --git a/packages/api-client-core/src/graphql-live-query-utils/createApplyLiveQueryPatch.ts b/packages/api-client-core/src/graphql-live-query-utils/createApplyLiveQueryPatch.ts index 0e9a2fe48..f13451f50 100644 --- a/packages/api-client-core/src/graphql-live-query-utils/createApplyLiveQueryPatch.ts +++ b/packages/api-client-core/src/graphql-live-query-utils/createApplyLiveQueryPatch.ts @@ -38,12 +38,14 @@ export const createApplyLiveQueryPatch = const valueToPublish: ExecutionLivePatchResult = {}; if (next.value.revision === 1) { - if (!next.value.data) { + if (next.value.data !== undefined) { + valueToPublish.data = next.value.data; + + mutableData = next.value.data; + lastRevision = 1; + } else { throw new Error("Missing data."); } - valueToPublish.data = next.value.data; - mutableData = next.value.data; - lastRevision = 1; } else { if (!mutableData) { throw new Error("No previousData available.");