From 17d9da6f4e44788986d64e4aca3769d09e2576e4 Mon Sep 17 00:00:00 2001 From: icarus Date: Fri, 12 Dec 2025 19:18:08 +0800 Subject: [PATCH] refactor(toast): remove deprecated toast utilities and update comment Remove deprecated toast API functions that were no-ops and update dataLimit comment to reflect current toast limitations --- src/renderer/src/components/TopView/toast.tsx | 42 ------------------- src/renderer/src/utils/dataLimit.ts | 4 +- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/src/renderer/src/components/TopView/toast.tsx b/src/renderer/src/components/TopView/toast.tsx index 081a436892..0731a1b4bb 100644 --- a/src/renderer/src/components/TopView/toast.tsx +++ b/src/renderer/src/components/TopView/toast.tsx @@ -178,51 +178,9 @@ export const loading = (args: RequireSome): strin */ export const addToast = (config: ToastConfig) => info(config) -/** - * Close a specific toast notification by its key - * @param key - Toast key (string) - */ -export const closeToast = (key: string) => { - getMessageApi().destroy(key) -} - -/** - * Close all toast notifications - */ -export const closeAll = () => { - getMessageApi().destroy() -} - -/** - * Stub functions for compatibility with previous toast API - * These are no-ops since antd message doesn't expose a queue - */ - -/** - * @deprecated This function is a no-op stub for backward compatibility only. - * Antd message doesn't expose a queue. Do not rely on this function. - * @returns Empty toast queue stub - */ -export const getToastQueue = (): any => ({ toasts: [] }) - -/** - * @deprecated This function is a no-op stub for backward compatibility only. - * Antd message doesn't track closing state. Do not rely on this function. - * @param key - Toast key (unused) - * @returns Always returns false - */ -export const isToastClosing = (key?: string): boolean => { - key // unused - return false -} - export const getToastUtilities = () => ({ - getToastQueue, addToast, - closeToast, - closeAll, - isToastClosing, error, success, warning, diff --git a/src/renderer/src/utils/dataLimit.ts b/src/renderer/src/utils/dataLimit.ts index 2c8db0697b..6e79732ab7 100644 --- a/src/renderer/src/utils/dataLimit.ts +++ b/src/renderer/src/utils/dataLimit.ts @@ -83,8 +83,8 @@ export async function checkDataLimit() { } currentInterval = setInterval(check, CHECK_INTERVAL_WARNING) } else if (!shouldShowWarning && currentToastId) { - // Dismiss toast when space is recovered - window.toast.closeToast(currentToastId) + // TODO: new toast component cannot be closed programmatically. add a dismiss button in the toast. + // window.toast.closeToast(currentToastId) currentToastId = null // Switch back to normal mode