From 1eee186e793d1c7abcf9ff4d98a189944a0ebeda Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 2 Jun 2019 07:13:10 -0700 Subject: [PATCH] Fix toast on Firefox (#3239) --- src/managers/notification-manager.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/managers/notification-manager.ts b/src/managers/notification-manager.ts index 0cc3dda81d..4498ff78f4 100644 --- a/src/managers/notification-manager.ts +++ b/src/managers/notification-manager.ts @@ -35,13 +35,18 @@ class NotificationManager extends LitElement { @query("ha-toast") private _toast!: HaToast; - public showDialog({ + public async showDialog({ message, action, duration, dismissable, }: ShowToastParams) { - const toast = this._toast; + let toast = this._toast; + // Can happen on initial load + if (!toast) { + await this.updateComplete; + toast = this._toast; + } toast.setAttribute("dir", computeRTL(this.hass) ? "rtl" : "ltr"); this._action = action || undefined; this._noCancelOnOutsideClick =