1
0
Fork 0
mirror of synced 2024-07-29 10:05:55 +12:00

Revert removing loading blockers in forms to fix multiple issues

This commit is contained in:
Andrew Kingston 2022-12-05 12:10:24 +00:00
parent ddb515a566
commit d0ed60ee3a

View file

@ -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 @@
)
</script>
{#key resetKey}
<InnerForm
{dataSource}
{theme}
{size}
{disabled}
{actionType}
{schema}
{table}
{initialValues}
{disableValidation}
{editAutoColumns}
>
<slot />
</InnerForm>
{/key}
{#if loaded}
{#key resetKey}
<InnerForm
{dataSource}
{theme}
{size}
{disabled}
{actionType}
{schema}
{table}
{initialValues}
{disableValidation}
{editAutoColumns}
>
<slot />
</InnerForm>
{/key}
{/if}