diff --git a/src/frontend/src/components/NotificationCenter.tsx b/src/frontend/src/components/NotificationCenter.tsx index 3ccc4b2..115f45f 100644 --- a/src/frontend/src/components/NotificationCenter.tsx +++ b/src/frontend/src/components/NotificationCenter.tsx @@ -66,15 +66,18 @@ export default function NotificationCenter({ onClose }: { onClose: () => void }) 'agent_completed', 'agent_spawned', ]; if (importantTypes.includes(e.type || data.event_type)) { - setSseEvents(prev => [{ - id: data.id || `sse-${Date.now()}`, - type: (e.type === 'task_failed' ? 'error' : e.type === 'task_completed' ? 'success' : 'info') as NotifItem['type'], - title: data.title || data.event_type || e.type, - message: data.detail || JSON.stringify(data).slice(0, 100), - time: data.timestamp || new Date().toISOString(), - read: false, - source: 'event' as const, - }, ...prev].slice(0, 20)]); + setSseEvents(prev => { + const item: NotifItem = { + id: data.id || `sse-${Date.now()}`, + type: e.type === 'task_failed' ? 'error' : e.type === 'task_completed' ? 'success' : 'info', + title: data.title || data.event_type || e.type || 'Event', + message: data.detail || JSON.stringify(data).slice(0, 100), + time: data.timestamp || new Date().toISOString(), + read: false, + source: 'event', + }; + return [item, ...prev].slice(0, 20); + }); } } catch { /* ignore parse errors */ } };