root: more strict singleton fix

This commit is contained in:
bordun 2020-04-27 10:07:26 +02:00
parent 4fe55e77d5
commit 558bbb985a

View file

@ -183,10 +183,17 @@ class Widget extends EventEmitter {
this.createPropsCache()
if (this.getProp('id') == 'root' && this.parent !== widgetManager) {
this.props.id = '_root'
this.cachedProps.id = '_root'
this.errors.id = 'There can only be one root'
}
if (this.getProp('type') == 'root' && this.parent !== widgetManager) {
this.props.type = 'panel'
this.cachedProps.type = 'panel'
}
// cache decimals
if (this.props.decimals !== undefined) {
this.decimals = Math.min(20, Math.max(this.getProp('decimals'), 0))