mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 14:56:37 +00:00
Dont create new array on every render (#5177)
This commit is contained in:
parent
785ae4a83d
commit
669ed5cb28
@ -15,12 +15,15 @@ import "../../../components/map/ha-map";
|
|||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { showZoneEditor } from "../../../data/zone";
|
import { showZoneEditor } from "../../../data/zone";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
|
import memoizeOne from "memoize-one";
|
||||||
|
|
||||||
@customElement("more-info-person")
|
@customElement("more-info-person")
|
||||||
class MoreInfoPerson extends LitElement {
|
class MoreInfoPerson extends LitElement {
|
||||||
@property() public hass!: HomeAssistant;
|
@property() public hass!: HomeAssistant;
|
||||||
@property() public stateObj?: HassEntity;
|
@property() public stateObj?: HassEntity;
|
||||||
|
|
||||||
|
private _entityArray = memoizeOne((entityId: string) => [entityId]);
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
if (!this.hass || !this.stateObj) {
|
if (!this.hass || !this.stateObj) {
|
||||||
return html``;
|
return html``;
|
||||||
@ -35,7 +38,7 @@ class MoreInfoPerson extends LitElement {
|
|||||||
? html`
|
? html`
|
||||||
<ha-map
|
<ha-map
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.entities=${[this.stateObj.entity_id]}
|
.entities=${this._entityArray(this.stateObj.entity_id)}
|
||||||
></ha-map>
|
></ha-map>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user