Improve performance of multistep form block even more and fix missing params
This commit is contained in:
parent
65b4b6c35d
commit
9149828c7c
|
@ -28,9 +28,11 @@
|
||||||
|
|
||||||
$: id = $component.id
|
$: id = $component.id
|
||||||
$: selected = $component.selected
|
$: selected = $component.selected
|
||||||
|
$: inBuilder = $builderStore.inBuilder
|
||||||
|
$: builderStep = $builderStore.metadata?.step
|
||||||
$: fetchSchema(dataSource)
|
$: fetchSchema(dataSource)
|
||||||
$: updateCurrentStep(enrichedSteps, $builderStore, id, selected)
|
$: enrichedSteps = enrichSteps(steps, schema, id)
|
||||||
$: enrichedSteps = enrichSteps(steps, schema, id, $currentStep)
|
$: updateCurrentStep(enrichedSteps, selected, inBuilder, builderStep)
|
||||||
|
|
||||||
// Provide additional data context for live binding eval
|
// Provide additional data context for live binding eval
|
||||||
export const getAdditionalDataContext = () => {
|
export const getAdditionalDataContext = () => {
|
||||||
|
@ -42,17 +44,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateCurrentStep = (steps, builderStore, id, selected) => {
|
const updateCurrentStep = (steps, selected, inBuilder, builderStep) => {
|
||||||
const { componentId, step } = builderStore.metadata || {}
|
|
||||||
|
|
||||||
// If we aren't in the builder or aren't selected then don't update the step
|
// If we aren't in the builder or aren't selected then don't update the step
|
||||||
// context at all, allowing the normal form to take control.
|
// context at all, allowing the normal form to take control.
|
||||||
if (!selected || !builderStore.inBuilder || componentId !== id) {
|
if (!selected || !inBuilder) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we have a valid step selected
|
// Ensure we have a valid step selected
|
||||||
let newStep = Math.min(step || 0, steps.length - 1)
|
let newStep = Math.min(builderStep || 0, steps.length - 1)
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
newStep = Math.max(newStep, 0)
|
newStep = Math.max(newStep, 0)
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
currentStep.set(newStep + 1)
|
currentStep.set(newStep + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchSchema = async () => {
|
const fetchSchema = async dataSource => {
|
||||||
schema = (await fetchDatasourceSchema(dataSource)) || {}
|
schema = (await fetchDatasourceSchema(dataSource)) || {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue