diff --git a/src/common/dom/dynamic-element-directive.ts b/src/common/dom/dynamic-element-directive.ts index 8f05f437ef..fe863e48b8 100644 --- a/src/common/dom/dynamic-element-directive.ts +++ b/src/common/dom/dynamic-element-directive.ts @@ -10,10 +10,7 @@ export const dynamicElement = directive( let element = part.value as HTMLElement | undefined; - if ( - element !== undefined && - tag.toUpperCase() === (element as HTMLElement).tagName - ) { + if (tag === element?.localName) { if (properties) { Object.entries(properties).forEach(([key, value]) => { element![key] = value; diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index dc2eb77ba3..a0c3378af6 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -70,8 +70,21 @@ export class MoreInfoDialog extends LitElement { this._entityId = params.entityId; if (!this._entityId) { this.closeDialog(); + return; } this.large = false; + + const stateObj = this.hass.states[this._entityId]; + if (!stateObj) { + return; + } + if (stateObj.attributes && "custom_ui_more_info" in stateObj.attributes) { + this._moreInfoType = stateObj.attributes.custom_ui_more_info; + } else { + const type = stateMoreInfoType(stateObj); + importMoreInfoControl(type); + this._moreInfoType = type === "hidden" ? undefined : `more-info-${type}`; + } } public closeDialog() { @@ -94,23 +107,6 @@ export class MoreInfoDialog extends LitElement { return false; } - protected updated(changedProperties) { - if (!this.hass || !this._entityId || !changedProperties.has("_entityId")) { - return; - } - const stateObj = this.hass.states[this._entityId]; - if (!stateObj) { - return; - } - if (stateObj.attributes && "custom_ui_more_info" in stateObj.attributes) { - this._moreInfoType = stateObj.attributes.custom_ui_more_info; - } else { - const type = stateMoreInfoType(stateObj); - importMoreInfoControl(type); - this._moreInfoType = type === "hidden" ? undefined : `more-info-${type}`; - } - } - protected render() { if (!this._entityId) { return html``;