Skip to content

Commit

Permalink
feat: don't delay onClose callback #1179
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed Dec 16, 2024
1 parent e6f8aa8 commit b33eda3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/containerObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand All @@ -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);

Expand Down

0 comments on commit b33eda3

Please sign in to comment.