Skip to content

Commit

Permalink
Fix removeToastNotification to use previousState
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronknol committed Sep 20, 2024
1 parent c29094e commit 4422137
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-wolves-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kaizen/components": patch
---

Fix removeToastNotification
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,7 @@ export const ToastNotificationProvider = ({
}

const removeToastNotification = (notificationID: string): void => {
const notificationIndex = notifications.findIndex(
({ id }) => id === notificationID
)
const copy = notifications.slice()
copy.splice(notificationIndex, 1) // Mutation
setNotifications(copy)
setNotifications(prev => prev.filter(({ id }) => id !== notificationID))
}

const clearToastNotifications = (): void => {
Expand Down

0 comments on commit 4422137

Please sign in to comment.