Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: pages that only display start from the answer they last saw, then refresh behind it

usePolled takes a cache key: it saves each answer in localStorage and starts
from the saved one, so opening the agents, alerts, builds, review runs or hives
view shows the last data at once and the refresh spinner marks the update. A
saved answer is dropped after a day, when it was saved by another build of the
UI, at log out (a new onLogout of the shared user menu) and when the gateway
ends the login (a new onSessionEnded of the session guard). Pages with an
editor (schedules, notification flows, broadcast) do not use it.
This commit is contained in:
iris 2026-11-05 23:14:25 +01:00
commit fd51cbd19d

View file

@ -100,8 +100,10 @@ export function AgentsPage() {
error,
refreshing,
setData: setRows,
} = usePolled(intervalMs, (signal) =>
fetchJson<AgentRow[]>("/api/agents/status", signal),
} = usePolled(
intervalMs,
(signal) => fetchJson<AgentRow[]>("/api/agents/status", signal),
{ cacheKey: "agents" },
);
const [createOpen, setCreateOpen] = useState(false);
// The PUT response is the hive's whole declaration set (every agent's