mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
History data not updating (#385)
* History data not updating Fix history data not updating. History chart data will cache for 3 minutes. To reload, change the period dropdown to another value and change back. * remove history cache
This commit is contained in:
parent
0e687fb243
commit
c289f6c925
@ -3,7 +3,6 @@
|
|||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
var RECENT_THRESHOLD = 60000; // 1 minute
|
var RECENT_THRESHOLD = 60000; // 1 minute
|
||||||
var DATE_CACHE = {};
|
|
||||||
var RECENT_CACHE = {};
|
var RECENT_CACHE = {};
|
||||||
|
|
||||||
function computeHistory(stateHistory) {
|
function computeHistory(stateHistory) {
|
||||||
@ -155,19 +154,17 @@
|
|||||||
|
|
||||||
getDate: function (startTime, endTime) {
|
getDate: function (startTime, endTime) {
|
||||||
var filter = startTime.toISOString() + '?end_time=' + endTime.toISOString();
|
var filter = startTime.toISOString() + '?end_time=' + endTime.toISOString();
|
||||||
if (!DATE_CACHE[filter]) {
|
|
||||||
DATE_CACHE[filter] = this.hass.callApi('GET', 'history/period/' + filter).then(
|
var prom = this.hass.callApi('GET', 'history/period/' + filter).then(
|
||||||
function (stateHistory) {
|
function (stateHistory) {
|
||||||
return computeHistory(stateHistory);
|
return computeHistory(stateHistory);
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
DATE_CACHE[filter] = false;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
return DATE_CACHE[filter];
|
return prom;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user