From 16734c7423431d039984e6776a9fb0608865f007 Mon Sep 17 00:00:00 2001 From: NovapaX Date: Wed, 28 Feb 2018 05:40:25 +0100 Subject: [PATCH] Fix history data processing (#951) * don't call filterchanged twice. it's already an observer. * fix data comparison Compare new data from ha-state-history-data to existing data and replace if changed * remove unnecessary styles * prevent multiple updates of chart-data * remove console * remove another console * directly binding because debouncing in history-data element shortening debounce time, works fine at 0 * remove inacurate comment --- panels/history/ha-panel-history.html | 21 +++------------------ src/components/state-history-charts.html | 10 ---------- src/data/ha-state-history-data.html | 23 ++++++++++++----------- 3 files changed, 15 insertions(+), 39 deletions(-) diff --git a/panels/history/ha-panel-history.html b/panels/history/ha-panel-history.html index 0931617998..7d38b24828 100644 --- a/panels/history/ha-panel-history.html +++ b/panels/history/ha-panel-history.html @@ -46,7 +46,7 @@ filter-type='[[_filterType]]' start-time='[[_computeStartTime(_currentDate)]]' end-time='[[endTime]]' - data='{{stateHistoryInput}}' + data='{{stateHistory}}' is-loading='{{isLoadingData}}' > @@ -83,7 +83,7 @@ @@ -115,13 +115,7 @@ class HaPanelHistory extends window.hassMixins.LocalizeMixin(Polymer.Element) { value: false, }, - stateHistoryInput: { - type: Object, - value: null, - observer: 'stateHistoryObserver' - }, - - stateHistoryOutput: { + stateHistory: { type: Object, value: null, }, @@ -199,15 +193,6 @@ class HaPanelHistory extends window.hassMixins.LocalizeMixin(Polymer.Element) { default: return 1; } } - - stateHistoryObserver(newVal) { - setTimeout(() => { - if (newVal === this.stateHistoryInput) { - // Input didn't change - this.stateHistoryOutput = newVal; - } - }, 1); - } } customElements.define(HaPanelHistory.is, HaPanelHistory); diff --git a/src/components/state-history-charts.html b/src/components/state-history-charts.html index 576f6c16c5..b591bac52c 100644 --- a/src/components/state-history-charts.html +++ b/src/components/state-history-charts.html @@ -10,16 +10,6 @@ :host { display: block; } - - .loading-container { - text-align: center; - padding: 8px; - } - - .loading { - height: 0px; - overflow: hidden; - }