From 463258febbb67bf866b107bed2417a100f6eade3 Mon Sep 17 00:00:00 2001
From: AAGaming <aa@mail.catvibers.me>
Date: Fri, 16 Sep 2022 18:49:35 -0400
Subject: wait for toaster ready, hopefully fix file browser patch

---
 frontend/src/toaster.tsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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

diff --git a/frontend/src/toaster.tsx b/frontend/src/toaster.tsx
index 3a922bfc..5590e43c 100644
--- a/frontend/src/toaster.tsx
+++ b/frontend/src/toaster.tsx
@@ -15,6 +15,7 @@ class Toaster extends Logger {
   private instanceRetPatch?: Patch;
   private node: any;
   private settingsModule: any;
+  private ready: boolean = false;
 
   constructor() {
     super('Toaster');
@@ -72,9 +73,13 @@ class Toaster extends Logger {
     };
     this.node.stateNode.forceUpdate();
     this.log('Initialized');
+    this.ready = true;
   }
 
-  toast(toast: ToastData) {
+  async toast(toast: ToastData) {
+    while (!this.ready) {
+      await sleep(100);
+    }
     const settings = this.settingsModule.settings;
     let toastData = {
       nNotificationID: window.NotificationStore.m_nNextTestNotificationID++,
-- 
cgit v1.2.3

