mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
[logbook] implement shouldUpdate (#4832)
* [logbook] implement shouldUpdate * Update src/panels/logbook/ha-logbook.ts Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io> Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
1437b4c4b6
commit
d48a4e0ac6
@ -59,7 +59,7 @@ class HaLogbookData extends PolymerElement {
|
||||
|
||||
this._setIsLoading(true);
|
||||
|
||||
this.getDate(this.filterDate, this.filterPeriod, this.filterEntity).then(
|
||||
this.getData(this.filterDate, this.filterPeriod, this.filterEntity).then(
|
||||
(logbookEntries) => {
|
||||
this._setEntries(logbookEntries);
|
||||
this._setIsLoading(false);
|
||||
@ -67,7 +67,7 @@ class HaLogbookData extends PolymerElement {
|
||||
);
|
||||
}
|
||||
|
||||
getDate(date, period, entityId) {
|
||||
getData(date, period, entityId) {
|
||||
if (!entityId) entityId = ALL_ENTITIES;
|
||||
|
||||
if (!DATA_CACHE[period]) DATA_CACHE[period] = [];
|
||||
|
@ -25,19 +25,14 @@ class HaLogbook extends LitElement {
|
||||
// @ts-ignore
|
||||
private _rtl = false;
|
||||
|
||||
protected updated(changedProps: PropertyValues) {
|
||||
super.updated(changedProps);
|
||||
if (!changedProps.has("hass")) {
|
||||
return;
|
||||
}
|
||||
protected shouldUpdate(changedProps: PropertyValues) {
|
||||
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
||||
if (oldHass && oldHass.language !== this.hass.language) {
|
||||
this._rtl = computeRTL(this.hass);
|
||||
}
|
||||
const languageChanged =
|
||||
oldHass === undefined || oldHass.language !== this.hass.language;
|
||||
return changedProps.has("entries") || languageChanged;
|
||||
}
|
||||
|
||||
protected firstUpdated(changedProps: PropertyValues) {
|
||||
super.firstUpdated(changedProps);
|
||||
protected updated(_changedProps: PropertyValues) {
|
||||
this._rtl = computeRTL(this.hass);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user