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}