mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Make Lovelace filter card more robust (#1431)
* Make Lovelace filter card more robust * Update hui-entity-filter-card.js
This commit is contained in:
parent
2e4ddebcda
commit
133d198e7c
@ -34,6 +34,7 @@ class HuiEntitiesCard extends PolymerElement {
|
||||
|
||||
if (this.lastChild) {
|
||||
this.removeChild(this.lastChild);
|
||||
this._element = null;
|
||||
}
|
||||
|
||||
const card = 'card' in config ? Object.assign({}, config.card) : {};
|
||||
@ -43,14 +44,12 @@ class HuiEntitiesCard extends PolymerElement {
|
||||
const element = createCardElement(card);
|
||||
element._filterRawConfig = card;
|
||||
this._updateCardConfig(element);
|
||||
element.hass = this.hass;
|
||||
this.appendChild(element);
|
||||
|
||||
this._element = element;
|
||||
}
|
||||
|
||||
_hassChanged(hass) {
|
||||
const element = this.lastChild;
|
||||
this._updateCardConfig(element);
|
||||
element.hass = hass;
|
||||
_hassChanged() {
|
||||
this._updateCardConfig(this._element);
|
||||
}
|
||||
|
||||
_updateCardConfig(element) {
|
||||
@ -69,6 +68,10 @@ class HuiEntitiesCard extends PolymerElement {
|
||||
{ entities: entitiesList }
|
||||
));
|
||||
element.isPanel = this.isPanel;
|
||||
element.hass = this.hass;
|
||||
|
||||
// Attach element if it has never been attached.
|
||||
if (!this.lastChild) this.appendChild(element);
|
||||
}
|
||||
}
|
||||
customElements.define('hui-entity-filter-card', HuiEntitiesCard);
|
||||
|
Loading…
x
Reference in New Issue
Block a user