diff --git a/src/managers/notification-manager.ts b/src/managers/notification-manager.ts index 1ac7537415..41dbdde058 100644 --- a/src/managers/notification-manager.ts +++ b/src/managers/notification-manager.ts @@ -8,6 +8,8 @@ import type { HaToast } from "../components/ha-toast"; import type { HomeAssistant } from "../types"; export interface ShowToastParams { + // Unique ID for the toast. If a new toast is shown with the same ID as the previous toast, it will be replaced to avoid flickering. + id?: string; message: string; action?: ToastActionParams; duration?: number; @@ -27,7 +29,9 @@ class NotificationManager extends LitElement { @query("ha-toast") private _toast!: HaToast | undefined; public async showDialog(parameters: ShowToastParams) { - this._toast?.close(); + if (!parameters.id || this._parameters?.id !== parameters.id) { + this._toast?.close(); + } if (!parameters || parameters.duration === 0) { this._parameters = undefined; diff --git a/src/state/disconnect-toast-mixin.ts b/src/state/disconnect-toast-mixin.ts index 08fdbe676c..133bd0a7ca 100644 --- a/src/state/disconnect-toast-mixin.ts +++ b/src/state/disconnect-toast-mixin.ts @@ -143,6 +143,7 @@ export default >(superClass: T) => )[0][0]; showToast(this, { + id: "integration_starting", message: this.hass!.localize("ui.notification_toast.integration_starting", { integration: domainToName(this.hass!.localize, integration),