Improve performance of multistep form block
This commit is contained in:
parent
80cc83d2f0
commit
fdde7f8895
|
@ -26,9 +26,11 @@
|
||||||
|
|
||||||
let schema
|
let schema
|
||||||
|
|
||||||
|
$: id = $component.id
|
||||||
|
$: selected = $component.selected
|
||||||
$: fetchSchema(dataSource)
|
$: fetchSchema(dataSource)
|
||||||
$: enrichedSteps = enrichSteps(steps, schema, $component.id, $currentStep)
|
$: updateCurrentStep(enrichedSteps, $builderStore, id, selected)
|
||||||
$: updateCurrentStep(enrichedSteps, $builderStore, $component)
|
$: enrichedSteps = enrichSteps(steps, schema, id, $currentStep)
|
||||||
|
|
||||||
// Provide additional data context for live binding eval
|
// Provide additional data context for live binding eval
|
||||||
export const getAdditionalDataContext = () => {
|
export const getAdditionalDataContext = () => {
|
||||||
|
@ -40,16 +42,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateCurrentStep = (steps, builderStore, component) => {
|
const updateCurrentStep = (steps, builderStore, id, selected) => {
|
||||||
const { componentId, step } = builderStore.metadata || {}
|
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 (
|
if (!selected || !builderStore.inBuilder || componentId !== id) {
|
||||||
!component.selected ||
|
|
||||||
!builderStore.inBuilder ||
|
|
||||||
componentId !== component.id
|
|
||||||
) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue