matrix: autopurge childrenHashes list
This commit is contained in:
parent
af830e5ee3
commit
22253f5693
1 changed files with 12 additions and 2 deletions
|
|
@ -100,11 +100,16 @@ class Matrix extends _matrix_base {
|
|||
var hashes = [...this.childrenHashes]
|
||||
this.childrenHashes = []
|
||||
|
||||
for (var i = 0; i < hashes.length; i++) {
|
||||
for (var i = hashes.length - 1; i >= 0; i--) {
|
||||
|
||||
let widget = widgetManager.widgets[hashes[i]],
|
||||
data = this.resolveProp('props', undefined, false, false, false, {'$':i})
|
||||
|
||||
if (!widget) {
|
||||
hashes.splice(i, 1)
|
||||
continue
|
||||
}
|
||||
|
||||
Object.assign(widget.props, data)
|
||||
widget.updateProps(Object.keys(data), this)
|
||||
|
||||
|
|
@ -115,8 +120,13 @@ class Matrix extends _matrix_base {
|
|||
this.childrenHashes = hashes
|
||||
} else {
|
||||
// widgets recreated
|
||||
for (i in this.childrenHashes) {
|
||||
|
||||
for (var i = this.childrenHashes.length - 1; i >= 0; i--) {
|
||||
let widget = widgetManager.widgets[this.childrenHashes[i]]
|
||||
if (!widget) {
|
||||
this.childrenHashes.splice(i, 1)
|
||||
continue
|
||||
}
|
||||
widget.container.classList.add('not-editable')
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue