Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat(toast): add logging for toast messages in showToast function

Tonho4fbbca105336
diff --git a/src/lib/stores/toast-store.svelte.ts b/src/lib/stores/toast-store.svelte.ts
index 4e4db222..15dc3423 100644
--- a/src/lib/stores/toast-store.svelte.ts
+++ b/src/lib/stores/toast-store.svelte.ts
@@ -1,3 +1,5 @@
+import { addLog } from "./debug-store.svelte";
+
export type ToastType = "success" | "error" | "info";
export type ToastItem = {
@@ -23,6 +25,8 @@ export function showToast(type: ToastType, message: string, duration?: number) {
const id = nextId++;
const ms = duration ?? (type === "error" ? ERROR_DURATION : DEFAULT_DURATION);
+ addLog(type === "error" ? "error" : "info", "system", message);
+
toasts = [...toasts, { id, type, message, closing: false }];
while (toasts.filter((t) => !t.closing).length > MAX_VISIBLE) {