diff --git a/src/components/ha-filter-domains.ts b/src/components/ha-filter-domains.ts index 16b5c2b1a8aa..e7b029719939 100644 --- a/src/components/ha-filter-domains.ts +++ b/src/components/ha-filter-domains.ts @@ -12,11 +12,6 @@ import "./ha-domain-icon"; import "./search-input-outlined"; import { computeDomain } from "../common/entity/compute_domain"; -type DomainTranslation = { - domain: string; - translation: string; -}; - @customElement("ha-filter-domains") export class HaFilterDomains extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; @@ -68,17 +63,17 @@ export class HaFilterDomains extends LitElement { (i) => i, (domain) => html` - ${domain.translation} + ${domainToName(this.hass.localize, domain)} ` )} ` @@ -88,22 +83,19 @@ export class HaFilterDomains extends LitElement { } private _domains = memoizeOne((states, filter) => { - const domains = new Map(); + const domains = new Set(); Object.keys(states).forEach((entityId) => { - const computedDomain = computeDomain(entityId); - domains.set(computedDomain, { - domain: computedDomain, - translation: domainToName(this.hass.localize, computedDomain), - }); + domains.add(computeDomain(entityId)); }); return Array.from(domains.values()) .filter( - (entry) => !filter || entry.translation.toLowerCase().includes(filter) + (entry) => + !filter || + entry.toLowerCase().includes(filter) || + domainToName(this.hass.localize, entry).toLowerCase().includes(filter) ) - .sort((a, b) => - stringCompare(a.translation, b.translation, this.hass.locale.language) - ); + .sort((a, b) => stringCompare(a, b, this.hass.locale.language)); }); protected updated(changed) {