From 04d26600fd5959ff13337f11dd9e1df1ae8bbb19 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Sat, 7 Mar 2026 20:32:11 +0000 Subject: [PATCH] Refactor NotificationContext to simplify notification fetching logic by removing redundant useEffect. Update condition checks for authenticated and notificationCenterVisible to use strict equality. --- src/components/Dashboard/context/NotificationContext.jsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/components/Dashboard/context/NotificationContext.jsx b/src/components/Dashboard/context/NotificationContext.jsx index 49acb02..516d8b4 100644 --- a/src/components/Dashboard/context/NotificationContext.jsx +++ b/src/components/Dashboard/context/NotificationContext.jsx @@ -113,17 +113,11 @@ const NotificationProvider = ({ children }) => { const unreadCount = notifications.filter((n) => !n.read).length useEffect(() => { - if (authenticated && notificationCenterVisible) { + if (authenticated == true && notificationCenterVisible == true) { fetchNotifications() } }, [authenticated, notificationCenterVisible, fetchNotifications]) - useEffect(() => { - if (authenticated) { - fetchNotifications() - } - }, [authenticated, fetchNotifications]) - useEffect(() => { setNotificationCenterVisible(false) }, [location.pathname])