From 8cd921f834784a6316c61e2ab21e57cb683742ae Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Fri, 18 Mar 2022 14:35:06 +0100 Subject: [PATCH] fetch the table which contains info about the primaryDisplay --- packages/client/src/components/app/forms/Form.svelte | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/client/src/components/app/forms/Form.svelte b/packages/client/src/components/app/forms/Form.svelte index f0000233e6..8e2e0b2510 100644 --- a/packages/client/src/components/app/forms/Form.svelte +++ b/packages/client/src/components/app/forms/Form.svelte @@ -17,6 +17,7 @@ let table $: fetchSchema(dataSource) + $: fetchTable(dataSource) // Returns the closes data context which isn't a built in context const getInitialValues = (type, dataSource, context) => { @@ -74,6 +75,16 @@ } } + const fetchTable = async dataSource => { + if (dataSource?.tableId) { + try { + table = await API.fetchTableDefinition(dataSource.tableId) + } catch (error) { + table = null + } + } + } + $: initialValues = getInitialValues(actionType, dataSource, $context) $: resetKey = Helpers.hashString( JSON.stringify(initialValues) + JSON.stringify(schema)