Fix stale alerts for deleted agents on command deck

This commit is contained in:
AetherForge
2026-06-02 22:09:09 -07:00
parent 96f683a72a
commit 9407efd960
3 changed files with 35 additions and 0 deletions

View File

@@ -108,6 +108,9 @@ export function WebSocketProvider({ children }: { children: React.ReactNode }) {
case 'agent_deleted': {
const { agent_id } = msg.payload as { agent_id: string };
setAgents((prev) => prev.filter((a) => a.id !== agent_id));
// Also purge any cached alerts for this agent so the dashboard
// alert banner stops showing errors for machines that no longer exist.
setFleetAlerts((prev) => prev.filter((a) => a.agent_id !== agent_id));
break;
}
case 'stats_update': {