From 8065934ee878957feaca21c5f78640a1849a3472 Mon Sep 17 00:00:00 2001 From: Fadi Khadra Date: Wed, 27 Nov 2024 14:24:51 -0500 Subject: [PATCH] feat: don't delay onClose callback #1179 --- src/core/containerObserver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/containerObserver.ts b/src/core/containerObserver.ts index 47abd292..4eb1275c 100644 --- a/src/core/containerObserver.ts +++ b/src/core/containerObserver.ts @@ -93,6 +93,7 @@ export function createContainerObserver( const { toastId, updateId, data, staleId, delay } = options; const closeToast = (removedByUser?: true) => { toasts.get(toastId)!.removedByUser = removedByUser; + toasts.get(toastId)!.props.onClose?.(removedByUser); removeToast(toastId); }; @@ -117,7 +118,6 @@ export function createContainerObserver( deleteToast() { const toastToRemove = toasts.get(toastId)!; - toastToRemove.props.onClose?.(toastToRemove.removedByUser); dispatchChanges(toToastItem(toastToRemove, 'removed')); toasts.delete(toastId);