From 2da22416c50602e40e279ae97fca61e67eaee73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Keviin=20=C3=85berg=20Kultalahti?= Date: Tue, 16 Feb 2021 15:29:24 +0100 Subject: [PATCH] fix: field property saved to wrong place --- .../backend/DataTable/modals/CreateEditColumn.svelte | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index 81b9274f36..52e26a4bf3 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -40,7 +40,7 @@ ] let types = ['Many to many (N:N)', 'One to many (1:N)'] - let selectedRelationshipType = 'Many to many (N:N)' + let selectedRelationshipType = field.relationshipType let indexes = [...($backendUiStore.selectedTable.indexes || [])] let confirmDeleteDialog @@ -55,12 +55,16 @@ UNEDITABLE_USER_FIELDS.includes(field.name) async function saveColumn() { + // Set relationship type if it's + if (field.type === 'link') { + field.relationshipType = relationshipTypes.find(type => type.text === selectedRelationshipType).value + } + backendUiStore.update(state => { backendUiStore.actions.tables.saveField({ originalName, field, primaryDisplay, - relationshipType: relationshipTypes.find(type => type.text === selectedRelationshipType).value, indexes, }) return state