widgets: prevent update errors when widgets are not fully initialized (add widget.mounted property)
This commit is contained in:
parent
47e7ed54b4
commit
aca78cd130
5 changed files with 14 additions and 0 deletions
|
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
## 0.48.3
|
||||
|
||||
- bug fixes
|
||||
- widgets: prevent update errors when widgets are not fully initialized
|
||||
|
||||
## 0.48.2
|
||||
|
||||
- bug fixes
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@ function updateWidget(widget, options={}) {
|
|||
}
|
||||
|
||||
|
||||
if (!widget.mounted) {
|
||||
console.debug(`updateWidget prevented on ${widget.getProp('id')} (widget not mounted yet)`)
|
||||
return
|
||||
}
|
||||
|
||||
var reuseChildren = options.reuseChildren !== false && widget instanceof Panel
|
||||
|
||||
var children = undefined,
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ var Parser = class Parser {
|
|||
|
||||
|
||||
parentNode.appendChild(widget.container)
|
||||
widget.mounted = true
|
||||
|
||||
// Editor needs to get the container object
|
||||
return widget
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ class Widget extends EventEmitter {
|
|||
this.children = []
|
||||
this.reCreateOptions = options.reCreateOptions
|
||||
this.removed = false
|
||||
this.mounted = false
|
||||
|
||||
this.createPropsCache()
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ class Panel extends Container() {
|
|||
for (let i = 0; i < this.children.length; i++) {
|
||||
if (this.children[i]) {
|
||||
this.wrapper.appendChild(this.children[i].container)
|
||||
this.children[i].mounted = true
|
||||
this.children[i].parent = this
|
||||
this.children[i].parentNode = this.wrapper
|
||||
} else {
|
||||
|
|
@ -98,6 +99,7 @@ class Panel extends Container() {
|
|||
for (let i = 0; i < this.children.length; i++) {
|
||||
if (this.children[i]) {
|
||||
this.widget.appendChild(this.children[i].container)
|
||||
this.children[i].mounted = true
|
||||
this.children[i].parent = this
|
||||
this.children[i].parentNode = this.widget
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue