Don't render cards when pane not visible

This commit is contained in:
Paulus Schoutsen 2016-07-31 10:56:52 -07:00
parent ad8a3cb59d
commit 59d347672f
3 changed files with 21 additions and 5 deletions

View File

@ -128,20 +128,27 @@
type: Object,
},
paneVisible: {
type: Boolean,
},
cards: {
type: Object,
},
},
observers: [
'updateCards(columns, states, showIntroduction)',
'updateCards(columns, states, showIntroduction, paneVisible)',
],
updateCards: function (columns, states, showIntroduction) {
updateCards: function (columns, states, showIntroduction, paneVisible) {
if (!paneVisible) {
return;
}
this.debounce(
'updateCards',
function () { this.cards = this.computeCards(columns, states, showIntroduction); },
0
function () { this.cards = this.computeCards(columns, states,
showIntroduction); }
);
},

View File

@ -30,6 +30,7 @@
attr-for-selected='id'
fallback-selection='panel-resolver'
selected='[[activePane]]'
selected-attribute='pane-visible'
>
<partial-cards
id='states'

View File

@ -54,7 +54,10 @@
<ha-cards
show-introduction='[[computeShowIntroduction(currentView, introductionLoaded, states)]]'
states='[[states]]' columns='[[columns]]' hass='[[hass]]'
states='[[states]]'
columns='[[columns]]'
hass='[[hass]]'
pane-visible='[[paneVisible]]'
></ha-cards>
</app-header-layout>
</template>
@ -77,6 +80,11 @@ Polymer({
value: false,
},
paneVisible: {
type: Boolean,
value: false,
},
isFetching: {
type: Boolean,
bindNuclear: function (hass) {