diff --git a/src/more-infos/more-info-camera.html b/src/more-infos/more-info-camera.html
index 9dd77403a5..aa6a2862d7 100644
--- a/src/more-infos/more-info-camera.html
+++ b/src/more-infos/more-info-camera.html
@@ -40,6 +40,16 @@ class MoreInfoCamera extends window.hassMixins.EventsMixin(Polymer.Element) {
};
}
+ connectedCallback() {
+ super.connectedCallback();
+ this.isVisible = true;
+ }
+
+ disconnectedCallback() {
+ this.isVisible = false;
+ super.disconnectedCallback();
+ }
+
imageLoaded() {
this.fire('iron-resize');
}
diff --git a/src/more-infos/more-info-content.html b/src/more-infos/more-info-content.html
index 398bcdd581..90a78ed80b 100644
--- a/src/more-infos/more-info-content.html
+++ b/src/more-infos/more-info-content.html
@@ -43,16 +43,21 @@ class MoreInfoContent extends Polymer.Element {
stateObjChanged(stateObj, hass) {
if (!stateObj || !hass) {
- // If root has lastChild, set 'isVisible' attribute of that child to false.
if (this.lastChild) {
- this.lastChild.isVisible = false;
+ this._detachedChild = this.lastChild;
+ // Detach child to prevent it from doing work.
+ this.removeChild(this.lastChild);
}
- } else {
- window.hassUtil.dynamicContentUpdater(
- this, 'MORE-INFO-' + window.hassUtil.stateMoreInfoType(stateObj).toUpperCase(),
- { hass: hass, stateObj: stateObj, isVisible: true }
- );
+ return;
}
+ if (this._detachedChild) {
+ this.appendChild(this._detachedChild);
+ this._detachedChild = null;
+ }
+ window.hassUtil.dynamicContentUpdater(
+ this, 'MORE-INFO-' + window.hassUtil.stateMoreInfoType(stateObj).toUpperCase(),
+ { hass: hass, stateObj: stateObj }
+ );
}
}