From 675a7a3b86154ea3e26b92a6a08a5cd8f415432b Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 13 Nov 2017 18:29:47 +0200 Subject: [PATCH] Fix group more-info not updating (#622) * Fix group more-info not updating * Remove old observer --- src/more-infos/more-info-content.html | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/more-infos/more-info-content.html b/src/more-infos/more-info-content.html index fbde6cc5e2..398bcdd581 100644 --- a/src/more-infos/more-info-content.html +++ b/src/more-infos/more-info-content.html @@ -25,34 +25,32 @@ class MoreInfoContent extends Polymer.Element { static get properties() { return { - hass: { - type: Object, - }, - - stateObj: { - type: Object, - observer: 'stateObjChanged', - }, + hass: Object, + stateObj: Object, }; } + static get observers() { + return [ + 'stateObjChanged(stateObj, hass)', + ]; + } + constructor() { super(); this.style.display = 'block'; } - stateObjChanged(stateObj) { - var rootEl; - if (!stateObj) { + stateObjChanged(stateObj, hass) { + if (!stateObj || !hass) { // If root has lastChild, set 'isVisible' attribute of that child to false. - rootEl = Polymer.dom(this); - if (rootEl.lastChild) { - rootEl.lastChild.isVisible = false; + if (this.lastChild) { + this.lastChild.isVisible = false; } } else { window.hassUtil.dynamicContentUpdater( this, 'MORE-INFO-' + window.hassUtil.stateMoreInfoType(stateObj).toUpperCase(), - { hass: this.hass, stateObj: stateObj, isVisible: true } + { hass: hass, stateObj: stateObj, isVisible: true } ); } }