mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-15 21:36:36 +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 { showZoneEditor } from "../../../data/zone";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import memoizeOne from "memoize-one";
|
||||
|
||||
@customElement("more-info-person")
|
||||
class MoreInfoPerson extends LitElement {
|
||||
@property() public hass!: HomeAssistant;
|
||||
@property() public stateObj?: HassEntity;
|
||||
|
||||
private _entityArray = memoizeOne((entityId: string) => [entityId]);
|
||||
|
||||
protected render(): TemplateResult {
|
||||
if (!this.hass || !this.stateObj) {
|
||||
return html``;
|
||||
@ -35,7 +38,7 @@ class MoreInfoPerson extends LitElement {
|
||||
? html`
|
||||
<ha-map
|
||||
.hass=${this.hass}
|
||||
.entities=${[this.stateObj.entity_id]}
|
||||
.entities=${this._entityArray(this.stateObj.entity_id)}
|
||||
></ha-map>
|
||||
`
|
||||
: ""}
|
||||
|
Loading…
x
Reference in New Issue
Block a user