diff --git a/contexts/NotificationsContext.tsx b/contexts/NotificationsContext.tsx index 031156a..70f3ea3 100644 --- a/contexts/NotificationsContext.tsx +++ b/contexts/NotificationsContext.tsx @@ -27,10 +27,14 @@ const NotificationsContext = createContext({ export const NotificationsProvider = ({ children }: { children: ReactNode }) => { const [notifications, setNotifications] = useState([]); const notify = (notification: TxNotification) => { + //if notification id already exists, don't add it again + const txId = `${notification.hash}-${notification.txStatus}-${notification.chainId}`; + if (notifications.some((n) => n.id === txId)) return; + setNotifications([ { ...notification, - id: `${notification.hash}-${notification.txStatus}-${notification.chainId}`, + id: txId, }, ...notifications, ]);