File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,17 @@ class DeclutteringCard extends LitElement {
26
26
27
27
private _hass ?: HomeAssistant ;
28
28
29
+ private _type ?: 'element' | 'card' ;
30
+
29
31
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
+ }
30
40
this . _hass = hass ;
31
41
if ( this . _card ) {
32
42
this . _card . hass = hass ;
@@ -75,12 +85,7 @@ class DeclutteringCard extends LitElement {
75
85
this . _displayHidden ( ) ;
76
86
} ) ;
77
87
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' ;
84
89
}
85
90
86
91
protected render ( ) : TemplateResult | void {
You can’t perform that action at this time.
0 commit comments