Handle errors as a part of the instance to avoid extra refreshes
This commit is contained in:
parent
2213cd56c4
commit
d3b22e461e
|
@ -138,7 +138,7 @@
|
||||||
|
|
||||||
// Derive definition properties which can all be optional, so need to be
|
// Derive definition properties which can all be optional, so need to be
|
||||||
// coerced to booleans
|
// coerced to booleans
|
||||||
$: invalidSettings = $builderStore.componentErrors[instance._id]
|
$: invalidSettings = instance?._meta?.errors
|
||||||
$: hasChildren = !!definition?.hasChildren
|
$: hasChildren = !!definition?.hasChildren
|
||||||
$: showEmptyState = definition?.showEmptyState !== false
|
$: showEmptyState = definition?.showEmptyState !== false
|
||||||
$: hasMissingRequiredSettings = missingRequiredSettings?.length > 0
|
$: hasMissingRequiredSettings = missingRequiredSettings?.length > 0
|
||||||
|
|
|
@ -42,6 +42,14 @@ const createScreenStore = () => {
|
||||||
if ($builderStore.layout) {
|
if ($builderStore.layout) {
|
||||||
activeLayout = $builderStore.layout
|
activeLayout = $builderStore.layout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attach meta
|
||||||
|
const errors = $builderStore.componentErrors || {}
|
||||||
|
const attachComponentMeta = component => {
|
||||||
|
component._meta = { errors: errors[component._id] || [] }
|
||||||
|
component._children?.forEach(attachComponentMeta)
|
||||||
|
}
|
||||||
|
attachComponentMeta(activeScreen.props)
|
||||||
} else {
|
} else {
|
||||||
// Find the correct screen by matching the current route
|
// Find the correct screen by matching the current route
|
||||||
screens = $appStore.screens || []
|
screens = $appStore.screens || []
|
||||||
|
|
Loading…
Reference in New Issue