perf: memoize derived render data

This commit is contained in:
2026-06-05 17:35:54 +08:00
parent 6060705345
commit b8b3b8f137
6 changed files with 143 additions and 56 deletions
+3 -3
View File
@@ -3,6 +3,8 @@
* Falls back gracefully when Notification API is unavailable.
*/
import { toast } from "../components/toast/toastStore";
let permissionGranted = false;
async function requestPermission(): Promise<boolean> {
@@ -35,9 +37,7 @@ export function notifyTaskCompleted(label: string, mode: "image" | "video" = "im
// Use the existing toast system for in-app notifications
function dispatchGenToast(msg: string) {
try {
import("../components/toast/toastStore").then((m) => m.toast(msg, "success"));
} catch { /* toast system not loaded */ }
toast(msg, "success");
}
/** Call once on app init to pre-warm permission. */