diff --git a/client/components/notifications/NotificationBell.tsx b/client/components/notifications/NotificationBell.tsx index 88960185..68e51508 100644 --- a/client/components/notifications/NotificationBell.tsx +++ b/client/components/notifications/NotificationBell.tsx @@ -80,12 +80,14 @@ export default function NotificationBell({ .getUserNotifications(user.id) .then((data) => { if (!isActive) return; + console.debug("[Notifications] Loaded", Array.isArray(data) ? data.length : 0, "notifications"); setNotifications( Array.isArray(data) ? (data as AethexNotification[]) : [], ); }) - .catch(() => { + .catch((err) => { if (!isActive) return; + console.warn("[Notifications] Failed to load:", err); setNotifications([]); }) .finally(() => { @@ -103,10 +105,12 @@ export default function NotificationBell({ if (!next?.id) return; setNotifications((prev) => { - if (prev.some((item) => item.id === next.id)) { - return prev; - } - return [next, ...prev].slice(0, 20); + // Check if notification already exists + const exists = prev.some((item) => item.id === next.id); + if (exists) return prev; + + // Add new notification to the top and keep up to 50 in the list + return [next, ...prev].slice(0, 50); }); aethexToast.aethex({ @@ -220,11 +224,12 @@ export default function NotificationBell({