From efbfff9a4f2c05956b7b6d3f0a313be04a0657a5 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 3 Jul 2025 19:17:53 +0200 Subject: [PATCH] Improve code --- src/dialogs/more-info/ha-more-info-dialog.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index 140a2e3b4f..52a2745115 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -307,7 +307,7 @@ export class MoreInfoDialog extends LitElement { deviceName = this.hass.formatEntityName(stateObj, "device"); areaName = this.hass.formatEntityName(stateObj, "area"); } else if (this._entry) { - const context = getEntityEntryContext( + const { device, area } = getEntityEntryContext( this._entry, this.hass.entities, this.hass.devices, @@ -315,10 +315,8 @@ export class MoreInfoDialog extends LitElement { this.hass.floors ); entityName = computeEntityEntryName(this._entry, this.hass.devices); - deviceName = context?.device - ? computeDeviceName(context.device) - : undefined; - areaName = context?.area ? computeAreaName(context.area) : undefined; + deviceName = device ? computeDeviceName(device) : undefined; + areaName = area ? computeAreaName(area) : undefined; } else { entityName = entityId; }