mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 18:56:39 +00:00
Prevent recreation of entities row on every update of hass (#5657)
This commit is contained in:
parent
8029c3d672
commit
1fdb6b8034
@ -28,24 +28,20 @@ import { EntityRegistryStateEntry } from "../ha-config-device-page";
|
|||||||
export class HaDeviceEntitiesCard extends LitElement {
|
export class HaDeviceEntitiesCard extends LitElement {
|
||||||
@property() public hass!: HomeAssistant;
|
@property() public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property() public deviceId!: string;
|
|
||||||
|
|
||||||
@property() public entities!: EntityRegistryStateEntry[];
|
@property() public entities!: EntityRegistryStateEntry[];
|
||||||
|
|
||||||
@property() public narrow!: boolean;
|
|
||||||
|
|
||||||
@property() private _showDisabled = false;
|
@property() private _showDisabled = false;
|
||||||
|
|
||||||
@queryAll("#entities > *") private _entityRows?: LovelaceRow[];
|
@queryAll("#entities > *") private _entityRows?: LovelaceRow[];
|
||||||
|
|
||||||
protected updated(changedProps: PropertyValues): void {
|
protected shouldUpdate(changedProps: PropertyValues) {
|
||||||
super.updated(changedProps);
|
if (changedProps.has("hass")) {
|
||||||
if (!changedProps.has("hass")) {
|
this._entityRows?.forEach((element) => {
|
||||||
return;
|
element.hass = this.hass;
|
||||||
|
});
|
||||||
|
return changedProps.size > 1;
|
||||||
}
|
}
|
||||||
this._entityRows?.forEach((element) => {
|
return true;
|
||||||
element.hass = this.hass;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user