Fix duplicate trigger IDs showing in the Triggered By condition (#14122)

This commit is contained in:
Brandon Rothweiler 2022-10-20 05:20:46 -04:00 committed by GitHub
parent 0a2eb05062
commit a46e72ffbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,8 +70,11 @@ export class HaTriggerCondition extends LitElement {
} }
private _automationUpdated(config?: AutomationConfig) { private _automationUpdated(config?: AutomationConfig) {
const seenIds = new Set();
this._triggers = config?.trigger this._triggers = config?.trigger
? ensureArray(config.trigger).filter((t) => t.id) ? ensureArray(config.trigger).filter(
(t) => t.id && (seenIds.has(t.id) ? false : seenIds.add(t.id))
)
: []; : [];
} }