Refactor NotificationContext to simplify notification fetching logic by removing redundant useEffect. Update condition checks for authenticated and notificationCenterVisible to use strict equality.
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good

This commit is contained in:
Tom Butcher 2026-03-07 20:32:11 +00:00
parent 52fd0ebd63
commit 04d26600fd

View File

@ -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])