From f8931106e8e8f1a57bb28b93e90d01579d8d6335 Mon Sep 17 00:00:00 2001 From: David Matejka Date: Fri, 7 Jun 2024 11:41:12 +0200 Subject: [PATCH] fix(binding): nothing to persist handling --- packages/binding/src/core/DataBinding.ts | 2 +- packages/binding/src/core/MutationGenerator.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/binding/src/core/DataBinding.ts b/packages/binding/src/core/DataBinding.ts index 49e851c17..fde499617 100644 --- a/packages/binding/src/core/DataBinding.ts +++ b/packages/binding/src/core/DataBinding.ts @@ -132,7 +132,7 @@ export class DataBinding { const generator = new MutationGenerator(this.treeStore, this.queryBuilder) const mutationResult = generator.getPersistMutation() - if (mutationResult === undefined) { + if (mutationResult.operations.length === 0) { await this.processEmptyPersistMutation(onPersistSuccess) return { type: 'nothingToPersist', diff --git a/packages/binding/src/core/MutationGenerator.ts b/packages/binding/src/core/MutationGenerator.ts index 3df7c921e..cae82376e 100644 --- a/packages/binding/src/core/MutationGenerator.ts +++ b/packages/binding/src/core/MutationGenerator.ts @@ -41,7 +41,7 @@ export class MutationGenerator { ) { } - public getPersistMutation(): PersistMutationResult | undefined { + public getPersistMutation(): PersistMutationResult { const mutations: Record> = {} const operations: SubMutationOperation[] = [] const processedPlaceholdersByEntity: ProcessedPlaceholdersByEntity = new Map()