Skip to content

Commit f25dbd4

Browse files
committed
Fix attempt for 0.110
1 parent 0213967 commit f25dbd4

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/decluttering-card.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@ class DeclutteringCard extends LitElement {
2626

2727
private _hass?: HomeAssistant;
2828

29+
private _type?: 'element' | 'card';
30+
2931
set hass(hass: HomeAssistant) {
32+
if (!hass) return;
33+
if (!this._hass && hass) {
34+
this._createCard(this._config!, this._type!).then(card => {
35+
this._card = card;
36+
this._card && this._ro?.observe(this._card);
37+
return this._card;
38+
});
39+
}
3040
this._hass = hass;
3141
if (this._card) {
3242
this._card.hass = hass;
@@ -75,12 +85,7 @@ class DeclutteringCard extends LitElement {
7585
this._displayHidden();
7686
});
7787
this._config = deepReplace(config.variables, templateConfig);
78-
const type = templateConfig.card ? 'card' : 'element';
79-
this._createCard(this._config, type).then(card => {
80-
this._card = card;
81-
this._ro?.observe(this._card);
82-
return this._card;
83-
});
88+
this._type = templateConfig.card ? 'card' : 'element';
8489
}
8590

8691
protected render(): TemplateResult | void {

0 commit comments

Comments
 (0)