Fix excessive rerendering of history charts (#8340)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
larena1 2021-02-24 17:48:50 +01:00 committed by GitHub
parent 782b941531
commit 0f574a765b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
PropertyValues,
TemplateResult,
} from "lit-element";
import "./state-history-chart-line";
@ -83,6 +84,10 @@ class StateHistoryCharts extends LitElement {
`;
}
protected shouldUpdate(changedProps: PropertyValues): boolean {
return !(changedProps.size === 1 && changedProps.has("hass"));
}
private _isHistoryEmpty(): boolean {
const historyDataEmpty =
!this.historyData ||