Allow null selector (#14212)

This commit is contained in:
Paul Bottein
2022-10-27 19:17:42 +02:00
committed by GitHub
parent a56b2e3270
commit 2ab5da6d84
17 changed files with 121 additions and 106 deletions

View File

@@ -30,9 +30,9 @@ export class HaSelectorAttribute extends SubscribeMixin(LitElement) {
return html`
<ha-entity-attribute-picker
.hass=${this.hass}
.entityId=${this.selector.attribute.entity_id ||
.entityId=${this.selector.attribute?.entity_id ||
this.context?.filter_entity}
.hideAttributes=${this.selector.attribute.hide_attributes}
.hideAttributes=${this.selector.attribute?.hide_attributes}
.value=${this.value}
.label=${this.label}
.helper=${this.helper}
@@ -49,7 +49,7 @@ export class HaSelectorAttribute extends SubscribeMixin(LitElement) {
// No need to filter value if no value
!this.value ||
// Only adjust value if we used the context
this.selector.attribute.entity_id ||
this.selector.attribute?.entity_id ||
// Only check if context has changed
!changedProps.has("context")
) {