From d0ed60ee3a4ee9d794d6d36024c9742c84b1a593 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 5 Dec 2022 12:10:24 +0000 Subject: [PATCH] Revert removing loading blockers in forms to fix multiple issues --- .../src/components/app/forms/Form.svelte | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/packages/client/src/components/app/forms/Form.svelte b/packages/client/src/components/app/forms/Form.svelte index e2a6dcf7c5..717bf00064 100644 --- a/packages/client/src/components/app/forms/Form.svelte +++ b/packages/client/src/components/app/forms/Form.svelte @@ -20,11 +20,11 @@ const context = getContext("context") const { API, fetchDatasourceSchema } = getContext("sdk") + let loaded = false let schema let table $: fetchSchema(dataSource) - $: fetchTable(dataSource) // Returns the closes data context which isn't a built in context const getInitialValues = (type, dataSource, context) => { @@ -47,10 +47,6 @@ // Fetches the form schema from this form's dataSource const fetchSchema = async dataSource => { - schema = (await fetchDatasourceSchema(dataSource)) || {} - } - - const fetchTable = async dataSource => { if (dataSource?.tableId && dataSource?.type !== "query") { try { table = await API.fetchTableDefinition(dataSource.tableId) @@ -58,6 +54,11 @@ table = null } } + const res = await fetchDatasourceSchema(dataSource) + schema = res || {} + if (!loaded) { + loaded = true + } } $: initialValues = getInitialValues(actionType, dataSource, $context) @@ -66,19 +67,21 @@ ) -{#key resetKey} - - - -{/key} +{#if loaded} + {#key resetKey} + + + + {/key} +{/if}