Skip to content

Commit

Permalink
fix(toaster): resolved issue where multiple toasts were not being dis…
Browse files Browse the repository at this point in the history
…missed (#4058)
  • Loading branch information
krisantrobus authored Sep 5, 2024
1 parent b20a3a1 commit 2951f5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/curly-ants-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@twilio-paste/toast": patch
"@twilio-paste/core": patch
---

[Toast] resolved issue where multiple toasts were not being dismissed
3 changes: 2 additions & 1 deletion packages/paste-core/components/toast/src/useToaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ export const useToaster = (): UseToasterReturnedProps => {
/**
* Clear all timeouts from the toaster when the component unmounts
*/

toasts.forEach((toast) => {
if (toast.timeOutId) {
window.clearTimeout(toast.timeOutId);
}
});
};
}, [toasts]);
}, []);

const pop = (id: ToasterToast["id"]): void => {
if (!isMounted.current) {
Expand Down

0 comments on commit 2951f5c

Please sign in to comment.