Skip to content

Commit

Permalink
remove useless toast delay
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Aug 8, 2024
1 parent 1265672 commit 7a161a5
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions frontend/src/toaster.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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');
Expand All @@ -53,7 +43,6 @@ class Toaster extends Logger {
});

this.log('Initialized');
sleep(4000).then(this.markReady);
}

toast(toast: ToastData): ToastNotification {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 7a161a5

Please sign in to comment.