From 04f5e9e9ea7f70b0ecc7b21e4837d55f2e058628 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 13 Oct 2020 15:40:59 +0100 Subject: [PATCH] optional chaining for backend ui models --- .../backend/TableNavigator/modals/CreateTableModal.svelte | 2 +- .../backend/TableNavigator/popovers/EditTablePopover.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte index 8bd3e56dae..29c24a2926 100644 --- a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte +++ b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte @@ -30,7 +30,7 @@ function checkValid(evt) { const tableName = evt.target.value - if ($backendUiStore.models.some(model => model.name === tableName)) { + if ($backendUiStore.models?.some(model => model.name === tableName)) { error = `Table with name ${tableName} already exists. Please choose another name.` return } diff --git a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte index eae0a66b5f..f69a5942a0 100644 --- a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte +++ b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte @@ -44,7 +44,7 @@ function checkValid(evt) { const tableName = evt.target.value - if (originalName !== tableName && $backendUiStore.models.some(model => model.name === tableName)) { + if (originalName !== tableName && $backendUiStore.models?.some(model => model.name === tableName)) { error = `Table with name ${tableName} already exists. Please choose another name.` return }