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
This commit is contained in:
icarus 2025-12-12 19:18:08 +08:00
parent b878315491
commit 17d9da6f4e
No known key found for this signature in database
GPG Key ID: D4AF089AAEC25D18
2 changed files with 2 additions and 44 deletions

View File

@ -178,51 +178,9 @@ export const loading = (args: RequireSome<LoadingToastConfig, 'promise'>): 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,

View File

@ -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