fix(frontend): refresh immédiat de la liste des agents après ajout — bus d'événements agent-roster (CustomEvent + BroadcastChannel multi-fenêtres) publié à la création d'un agent et écouté par useAgents, LayoutGrid et les panneaux skills/permissions/tâches planifiées/templates/tickets/workstate, plus besoin d'ajouter-retirer une cellule pour forcer le refresh — #361 (QA verte: typecheck OK, vitest agents/singletonAgent OK, npm test 1416 tests OK)
This commit is contained in:
@ -19,6 +19,10 @@ import type {
|
||||
} from "@/domain";
|
||||
import type { LiveAgent, OpenTerminalOptions, TerminalHandle } from "@/ports";
|
||||
import { useGateways } from "@/app/di";
|
||||
import {
|
||||
onAgentRosterChanged,
|
||||
publishAgentRosterChanged,
|
||||
} from "./agentRosterEvents";
|
||||
|
||||
/**
|
||||
* Per-agent session-limit state (ARCHITECTURE §21), populated from the limit
|
||||
@ -223,6 +227,14 @@ export function useAgents(projectId: string): AgentsViewModel {
|
||||
void refresh();
|
||||
}, [refresh]);
|
||||
|
||||
useEffect(
|
||||
() =>
|
||||
onAgentRosterChanged((change) => {
|
||||
if (change.projectId === projectId) void refresh();
|
||||
}),
|
||||
[projectId, refresh],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
void refreshLiveAgents();
|
||||
}, [refreshLiveAgents]);
|
||||
@ -360,6 +372,7 @@ export function useAgents(projectId: string): AgentsViewModel {
|
||||
initialContent,
|
||||
});
|
||||
setAgents((prev) => [...prev, created]);
|
||||
publishAgentRosterChanged(projectId);
|
||||
} catch (e) {
|
||||
setError(describe(e));
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user