From 93a4d9c99750f4109834ed6f7bcfd374dbade83e Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 21 Sep 2023 18:55:08 +0200 Subject: [PATCH] Fix translations onboarding integration --- src/onboarding/onboarding-integrations.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/onboarding/onboarding-integrations.ts b/src/onboarding/onboarding-integrations.ts index 831dcfbfd214..f095d57cfc3a 100644 --- a/src/onboarding/onboarding-integrations.ts +++ b/src/onboarding/onboarding-integrations.ts @@ -45,13 +45,12 @@ class OnboardingIntegrations extends SubscribeMixin(LitElement) { public hassSubscribe(): Array> { return [ subscribeConfigFlowInProgress(this.hass, (flows) => { - this._discovered = flows; + this._discovered = flows.filter( + (flow) => !HIDDEN_DOMAINS.has(flow.handler) + ); const integrations: Set = new Set(); - for (const flow of flows) { - // To render title placeholders - if (flow.context.title_placeholders) { - integrations.add(flow.handler); - } + for (const flow of this._discovered) { + integrations.add(flow.handler); } this.hass.loadBackendTranslation("title", Array.from(integrations)); }), @@ -60,12 +59,14 @@ class OnboardingIntegrations extends SubscribeMixin(LitElement) { (messages) => { let fullUpdate = false; const newEntries: ConfigEntry[] = []; + const integrations: Set = new Set(); messages.forEach((message) => { if (message.type === null || message.type === "added") { if (HIDDEN_DOMAINS.has(message.entry.domain)) { return; } newEntries.push(message.entry); + integrations.add(message.entry.domain); if (message.type === null) { fullUpdate = true; } @@ -86,6 +87,7 @@ class OnboardingIntegrations extends SubscribeMixin(LitElement) { if (!newEntries.length && !fullUpdate) { return; } + this.hass.loadBackendTranslation("title", Array.from(integrations)); const existingEntries = fullUpdate ? [] : this._entries; this._entries = [...existingEntries!, ...newEntries]; },