mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
fix(component): toast too many times when switch page mode (#2296)
This commit is contained in:
@@ -9,8 +9,20 @@ export const toast = (message: string, options?: ToastOptions) => {
|
||||
'.main-container'
|
||||
) as HTMLElement;
|
||||
logger.debug(`toast with message: "${message}"`, options);
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('affine-toast:emit', { detail: message })
|
||||
);
|
||||
return basicToast(message, {
|
||||
portal: mainContainer || document.body,
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
declare global {
|
||||
// global Events
|
||||
interface WindowEventMap {
|
||||
'affine-toast:emit': CustomEvent<{
|
||||
message: string;
|
||||
}>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user