From 721569c2d42899d63f649cc4d417170a097978b5 Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Thu, 26 Mar 2020 14:52:44 +0000 Subject: [PATCH] bugfix: child key not constructed correctly --- .../ModelDataTable/modals/CreateEditRecord.svelte | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte b/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte index c7ac755825..7d00256f3c 100644 --- a/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte +++ b/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte @@ -31,12 +31,14 @@ ? selectedModel.fields.map(({ name }) => name) : [] - $: currentCollectionKey = - $store.selectedRecord - ? joinKey($store.selectedRecord.key, selectedModel.collectionName) + + function getCurrentCollectionKey(selectedRecord) { + return selectedRecord + ? joinKey(selectedRecord.key, selectedModel.collectionName) : joinKey(selectedModel.collectionName) + } - $: editingRecord = editingRecord || record || getNewRecord(selectedModel, currentCollectionKey) + $: editingRecord = editingRecord || record || getNewRecord(selectedModel, getCurrentCollectionKey($backendUiStore.selectedRecord)) function closed() { editingRecord = null