From a37d6aaac2f0715bc634f7d374fb2f827e5b396e Mon Sep 17 00:00:00 2001 From: John Cowen Date: Fri, 3 May 2019 11:39:32 +0100 Subject: [PATCH] ui: Don't look for isDescriptor on null (related to null proxies) (#5782) --- ui-v2/app/mixins/with-event-source.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ui-v2/app/mixins/with-event-source.js b/ui-v2/app/mixins/with-event-source.js index f315f32f0b..aa2a22b6df 100644 --- a/ui-v2/app/mixins/with-event-source.js +++ b/ui-v2/app/mixins/with-event-source.js @@ -7,18 +7,18 @@ const PREFIX = '_'; export default Mixin.create(WithListeners, { setProperties: function(model) { const _model = {}; - Object.keys(model).forEach(key => { + Object.keys(model).forEach(prop => { // here (see comment below on deleting) - if (typeof this[key] !== 'undefined' && this[key].isDescriptor) { - _model[`${PREFIX}${key}`] = model[key]; - const meta = this.constructor.metaForProperty(key) || {}; + if (this[prop] && this[prop].isDescriptor) { + _model[`${PREFIX}${prop}`] = model[prop]; + const meta = this.constructor.metaForProperty(prop) || {}; if (typeof meta.catch === 'function') { - if (typeof _model[`${PREFIX}${key}`].addEventListener === 'function') { - this.listen(_model[`_${key}`], 'error', meta.catch.bind(this)); + if (typeof _model[`${PREFIX}${prop}`].addEventListener === 'function') { + this.listen(_model[`_${prop}`], 'error', meta.catch.bind(this)); } } } else { - _model[key] = model[key]; + _model[prop] = model[prop]; } }); return this._super(_model);