From 59d347672fb26b3bfe3e18ff00bb32df72bc7c3b Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 31 Jul 2016 10:56:52 -0700 Subject: [PATCH] Don't render cards when pane not visible --- src/components/ha-cards.html | 15 +++++++++++---- src/layouts/home-assistant-main.html | 1 + src/layouts/partial-cards.html | 10 +++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/components/ha-cards.html b/src/components/ha-cards.html index ea9b64cb02..7f5f934989 100644 --- a/src/components/ha-cards.html +++ b/src/components/ha-cards.html @@ -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); } ); }, diff --git a/src/layouts/home-assistant-main.html b/src/layouts/home-assistant-main.html index b5de397fce..0bc3bc0da2 100644 --- a/src/layouts/home-assistant-main.html +++ b/src/layouts/home-assistant-main.html @@ -30,6 +30,7 @@ attr-for-selected='id' fallback-selection='panel-resolver' selected='[[activePane]]' + selected-attribute='pane-visible' > @@ -77,6 +80,11 @@ Polymer({ value: false, }, + paneVisible: { + type: Boolean, + value: false, + }, + isFetching: { type: Boolean, bindNuclear: function (hass) {