Fix startup notifications

This commit is contained in:
Paul Bottein 2024-10-21 09:39:58 +02:00
parent 2518b1a79d
commit 24f9944319
No known key found for this signature in database
2 changed files with 6 additions and 1 deletions

View File

@ -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;

View File

@ -143,6 +143,7 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
)[0][0];
showToast(this, {
id: "integration_starting",
message:
this.hass!.localize("ui.notification_toast.integration_starting", {
integration: domainToName(this.hass!.localize, integration),