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, html,
LitElement, LitElement,
property, property,
PropertyValues,
TemplateResult, TemplateResult,
} from "lit-element"; } from "lit-element";
import "./state-history-chart-line"; 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 { private _isHistoryEmpty(): boolean {
const historyDataEmpty = const historyDataEmpty =
!this.historyData || !this.historyData ||