diff --git a/src/browser/js/app/widgets/matrices/matrix.js b/src/browser/js/app/widgets/matrices/matrix.js index 1fa6dba6..825e49fd 100644 --- a/src/browser/js/app/widgets/matrices/matrix.js +++ b/src/browser/js/app/widgets/matrices/matrix.js @@ -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') } }