From 7a161a5b833b55a31329f9f80116e09498f38368 Mon Sep 17 00:00:00 2001
From: AAGaming <aagaming@riseup.net>
Date: Thu, 8 Aug 2024 15:20:47 -0400
Subject: remove useless toast delay

---
 frontend/src/toaster.tsx | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

(limited to 'frontend/src/toaster.tsx')

diff --git a/frontend/src/toaster.tsx b/frontend/src/toaster.tsx
index 4f67c589..54c0d7fb 100644
--- a/frontend/src/toaster.tsx
+++ b/frontend/src/toaster.tsx
@@ -1,13 +1,5 @@
 import type { ToastData, ToastNotification } from '@decky/api';
-import {
-  ErrorBoundary,
-  Patch,
-  callOriginal,
-  findModuleExport,
-  injectFCTrampoline,
-  replacePatch,
-  sleep,
-} from '@decky/ui';
+import { ErrorBoundary, Patch, callOriginal, findModuleExport, injectFCTrampoline, replacePatch } from '@decky/ui';
 
 import Toast from './components/Toast';
 import Logger from './logger';
@@ -29,8 +21,6 @@ declare global {
 
 class Toaster extends Logger {
   private toastPatch?: Patch;
-  private markReady!: () => void;
-  private ready = new Promise<void>((r) => (this.markReady = r));
 
   constructor() {
     super('Toaster');
@@ -53,7 +43,6 @@ class Toaster extends Logger {
     });
 
     this.log('Initialized');
-    sleep(4000).then(this.markReady);
   }
 
   toast(toast: ToastData): ToastNotification {
@@ -120,7 +109,11 @@ class Toaster extends Logger {
         }
       }, toast.expiration);
     }
-    this.ready.then(() => window.NotificationStore.ProcessNotification(info, toastData, ToastType.New));
+    try {
+      window.NotificationStore.ProcessNotification(info, toastData, ToastType.New);
+    } catch (e) {
+      this.error('Error while sending toast:', e);
+    }
     return toastResult;
   }
 
-- 
cgit v1.2.3

