Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: repoint the HivesPage comments at HivesCard and pin the nav filter and lazy roster

This commit is contained in:
iris 2026-10-26 16:51:14 +01:00 • committed by mara
commit 209a286d7c
3 changed files with 63 additions and 18 deletions

View file

@ -4,7 +4,7 @@
// status panel has anything to render against without a roster to embed
// in — so all three ended up as one page.
//
// One fetch, on a refresh-interval cadence like HivesPage: `GET
// One fetch, on a refresh-interval cadence like HivesCard: `GET
// /api/agents/status` — one row per roster agent (identity store is the
// roster, so a never-reported agent still gets a row), each already
// carrying its freshness/snapshot/config PR/wanted state. Used to be
@ -51,7 +51,7 @@ import { CreateAgentForm } from "../CreateAgentForm.js";
import { WantedMenu } from "../../agent/roster/WantedMenu.js";
import "./AgentsPage.css";
// Same 30s default + same reasoning as HivesPage: no inputs on this page
// Same 30s default + same reasoning as HivesCard: no inputs on this page
// for a refresh to clobber, so the out-of-the-box behaviour should just
// solve staleness rather than require an opt-in every visit.
const DEFAULT_INTERVAL_MS: RefreshIntervalMs = 30_000;

View file

@ -25,6 +25,7 @@ import {
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
import { Table, type TableColumn } from "../../ui/table/Table.js";
import { domainCell } from "../hive-domain.js";
import { builtAfterToggle } from "./lazy-open.js";
type Freshness = "fresh" | "stale" | "never_reported" | "unknown";
@ -160,7 +161,7 @@ export function HivesCard() {
open={open}
onToggle={(next) => {
setOpen(next);
if (next) setBuilt(true);
setBuilt((was) => builtAfterToggle(was, next));
}}
>
{built ? <HiveRoster /> : null}

View file

@ -0,0 +1,5 @@
// A folded card builds its body on the first open and keeps it after, so a
// card nobody opens never fetches, and closing it does not drop what it read.
export function builtAfterToggle(built: boolean, open: boolean): boolean {
return built || open;
}