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 }