fix: use default value from schema for non inheritable fields

Eg. moreControl

Co-authored-by: David Larlet <david@larlet.fr>
This commit is contained in:
Yohan Boniface 2025-02-14 16:44:11 +01:00
parent 52b4244333
commit 2089d3b0c6

View file

@ -81,10 +81,14 @@ class BaseElement {
}
get() {
if (!this.properties.inheritable) return this.builder.getter(this.field)
let value
const path = this.field.split('.')
const key = path[path.length - 1]
const value = this.obj.getOption(key)
if (!this.properties.inheritable) {
value = this.builder.getter(this.field)
} else {
value = this.obj.getOption(key)
}
if (value === undefined) return SCHEMA[key]?.default
return value
}