mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Disconnect unused more-info (#945)
This commit is contained in:
parent
a88c6f49a2
commit
ebc21aaa40
@ -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() {
|
imageLoaded() {
|
||||||
this.fire('iron-resize');
|
this.fire('iron-resize');
|
||||||
}
|
}
|
||||||
|
@ -43,16 +43,21 @@ class MoreInfoContent extends Polymer.Element {
|
|||||||
|
|
||||||
stateObjChanged(stateObj, hass) {
|
stateObjChanged(stateObj, hass) {
|
||||||
if (!stateObj || !hass) {
|
if (!stateObj || !hass) {
|
||||||
// If root has lastChild, set 'isVisible' attribute of that child to false.
|
|
||||||
if (this.lastChild) {
|
if (this.lastChild) {
|
||||||
this.lastChild.isVisible = false;
|
this._detachedChild = this.lastChild;
|
||||||
|
// Detach child to prevent it from doing work.
|
||||||
|
this.removeChild(this.lastChild);
|
||||||
}
|
}
|
||||||
} else {
|
return;
|
||||||
window.hassUtil.dynamicContentUpdater(
|
|
||||||
this, 'MORE-INFO-' + window.hassUtil.stateMoreInfoType(stateObj).toUpperCase(),
|
|
||||||
{ hass: hass, stateObj: stateObj, isVisible: true }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
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 }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user