Skip to content

An opinionated toast component for React.

Fix inability to prevent toast from closing on action button click (#484)

Yury Demin8d33b51ebb99
diff --git a/src/index.tsx b/src/index.tsx
index 7df9d76..0b1fb77 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -405,8 +405,8 @@ const Toast = (props: ToastProps) => {
onClick={(event) => {
// We need to check twice because typescript
if (!isAction(toast.action)) return;
- if (event.defaultPrevented) return;
toast.action.onClick?.(event);
+ if (event.defaultPrevented) return;
deleteToast();
}}
className={cn(classNames?.actionButton, toast?.classNames?.actionButton)}