diff --git a/hooks/useNotificationManager.ts b/hooks/useNotificationManager.ts index 79bfd92c..ea3306ab 100644 --- a/hooks/useNotificationManager.ts +++ b/hooks/useNotificationManager.ts @@ -22,11 +22,20 @@ export function useNotificationManager() { txHash: string, status: "error" | "pending" | "success" ) => { - const index = notifications.findIndex( - (notification) => notification.data.hash === txHash - ); - notifications[index].data.status = status; - setNotifications(notifications); + const updatedNotifications = notifications.map((notification) => { + if (notification.data.hash === txHash) { + return { + ...notification, + data: { + ...notification.data, + status, + }, + }; + } + return notification; + }); + + setNotifications(updatedNotifications); }; const checkTransactionStatus = async (txHash: string) => {