Revert removing loading blockers in forms to fix multiple issues
This commit is contained in:
parent
cf7af9ffa0
commit
dd55af82d7
|
@ -20,11 +20,11 @@
|
||||||
const context = getContext("context")
|
const context = getContext("context")
|
||||||
const { API, fetchDatasourceSchema } = getContext("sdk")
|
const { API, fetchDatasourceSchema } = getContext("sdk")
|
||||||
|
|
||||||
|
let loaded = false
|
||||||
let schema
|
let schema
|
||||||
let table
|
let table
|
||||||
|
|
||||||
$: fetchSchema(dataSource)
|
$: fetchSchema(dataSource)
|
||||||
$: fetchTable(dataSource)
|
|
||||||
|
|
||||||
// Returns the closes data context which isn't a built in context
|
// Returns the closes data context which isn't a built in context
|
||||||
const getInitialValues = (type, dataSource, context) => {
|
const getInitialValues = (type, dataSource, context) => {
|
||||||
|
@ -47,10 +47,6 @@
|
||||||
|
|
||||||
// Fetches the form schema from this form's dataSource
|
// Fetches the form schema from this form's dataSource
|
||||||
const fetchSchema = async dataSource => {
|
const fetchSchema = async dataSource => {
|
||||||
schema = (await fetchDatasourceSchema(dataSource)) || {}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fetchTable = async dataSource => {
|
|
||||||
if (dataSource?.tableId && dataSource?.type !== "query") {
|
if (dataSource?.tableId && dataSource?.type !== "query") {
|
||||||
try {
|
try {
|
||||||
table = await API.fetchTableDefinition(dataSource.tableId)
|
table = await API.fetchTableDefinition(dataSource.tableId)
|
||||||
|
@ -58,6 +54,11 @@
|
||||||
table = null
|
table = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const res = await fetchDatasourceSchema(dataSource)
|
||||||
|
schema = res || {}
|
||||||
|
if (!loaded) {
|
||||||
|
loaded = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: initialValues = getInitialValues(actionType, dataSource, $context)
|
$: initialValues = getInitialValues(actionType, dataSource, $context)
|
||||||
|
@ -66,19 +67,21 @@
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#key resetKey}
|
{#if loaded}
|
||||||
<InnerForm
|
{#key resetKey}
|
||||||
{dataSource}
|
<InnerForm
|
||||||
{theme}
|
{dataSource}
|
||||||
{size}
|
{theme}
|
||||||
{disabled}
|
{size}
|
||||||
{actionType}
|
{disabled}
|
||||||
{schema}
|
{actionType}
|
||||||
{table}
|
{schema}
|
||||||
{initialValues}
|
{table}
|
||||||
{disableValidation}
|
{initialValues}
|
||||||
{editAutoColumns}
|
{disableValidation}
|
||||||
>
|
{editAutoColumns}
|
||||||
<slot />
|
>
|
||||||
</InnerForm>
|
<slot />
|
||||||
{/key}
|
</InnerForm>
|
||||||
|
{/key}
|
||||||
|
{/if}
|
||||||
|
|
Loading…
Reference in New Issue