matrix: autopurge childrenHashes list

This commit is contained in:
jean-emmanuel 2018-07-19 10:57:09 +02:00
parent af830e5ee3
commit 22253f5693

View file

@ -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')
}
}