File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 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 {
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 {
You can’t perform that action at this time.
0 commit comments