Skip to content

Commit

Permalink
Fix attempt for 0.110
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider committed May 21, 2020
1 parent 0213967 commit f25dbd4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/decluttering-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ class DeclutteringCard extends LitElement {

private _hass?: HomeAssistant;

private _type?: 'element' | 'card';

set hass(hass: HomeAssistant) {
if (!hass) return;
if (!this._hass && hass) {
this._createCard(this._config!, this._type!).then(card => {
this._card = card;
this._card && this._ro?.observe(this._card);
return this._card;
});
}
this._hass = hass;
if (this._card) {
this._card.hass = hass;
Expand Down Expand Up @@ -75,12 +85,7 @@ class DeclutteringCard extends LitElement {
this._displayHidden();
});
this._config = deepReplace(config.variables, templateConfig);
const type = templateConfig.card ? 'card' : 'element';
this._createCard(this._config, type).then(card => {
this._card = card;
this._ro?.observe(this._card);
return this._card;
});
this._type = templateConfig.card ? 'card' : 'element';
}

protected render(): TemplateResult | void {
Expand Down

0 comments on commit f25dbd4

Please sign in to comment.