mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-08 02:19:43 +00:00
🔧 Remove unnecessary re-renders (#3014)
* 🔧 Remove unnecessary re-renders
* address review comments
* address review comments
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
CSSResult,
|
||||
css,
|
||||
customElement,
|
||||
PropertyValues,
|
||||
} from "lit-element";
|
||||
|
||||
import "../components/hui-generic-entity-row";
|
||||
@@ -14,6 +15,7 @@ import "../components/hui-warning";
|
||||
import computeStateDisplay from "../../../common/entity/compute_state_display";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
import { EntityRow, EntityConfig } from "./types";
|
||||
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
||||
|
||||
@customElement("hui-text-entity-row")
|
||||
class HuiTextEntityRow extends LitElement implements EntityRow {
|
||||
@@ -28,6 +30,10 @@ class HuiTextEntityRow extends LitElement implements EntityRow {
|
||||
this._config = config;
|
||||
}
|
||||
|
||||
protected shouldUpdate(changedProps: PropertyValues): boolean {
|
||||
return hasConfigOrEntityChanged(this, changedProps);
|
||||
}
|
||||
|
||||
protected render(): TemplateResult | void {
|
||||
if (!this._config || !this.hass) {
|
||||
return html``;
|
||||
|
||||
Reference in New Issue
Block a user