Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: the refresh picker shows a spinner in place of its clock while its page is fetching

usePolled reports when a request is in flight (through a new onBusy of the
poller) and holds it on for at least 0.4 seconds, so a quick answer still
reads as a refresh. The picker swaps its clock for the spinner, in the same
box so its width stays, and the spinner stands still where motion is off.
Every page with a picker passes it; a page with several polled requests shows
it while any of them runs. The Jobs page fetches through shared components
and has none yet.
This commit is contained in:
iris 2026-11-05 23:09:07 +01:00
commit 47c447409b

View file

@ -41,18 +41,24 @@ export function NotificationRouter() {
const {
data: view,
error,
refreshing: flowsRefreshing,
refresh,
} = usePolled(intervalMs, (signal) =>
fetchJson<FlowsView>("/api/notify/flows", signal),
);
// The router's own answers. Either is 503 while the running router predates
// it, which the page says in place of the section.
const { data: dry, error: dryError } = usePolled(intervalMs, (signal) =>
fetchJson<DryRun>(DRY_RUN_URL, signal),
);
const { data: deliveries, error: deliveriesError } = usePolled(
intervalMs,
(signal) => fetchJson<DeliveriesView>(DELIVERIES_URL, signal),
const {
data: dry,
error: dryError,
refreshing: dryRefreshing,
} = usePolled(intervalMs, (signal) => fetchJson<DryRun>(DRY_RUN_URL, signal));
const {
data: deliveries,
error: deliveriesError,
refreshing: deliveriesRefreshing,
} = usePolled(intervalMs, (signal) =>
fetchJson<DeliveriesView>(DELIVERIES_URL, signal),
);
// A failed poll keeps the last answer; the counts are shown only while the
// latest poll worked.
@ -102,6 +108,7 @@ export function NotificationRouter() {
id="notifications-refresh"
value={intervalMs}
onChange={setIntervalMs}
refreshing={flowsRefreshing || dryRefreshing || deliveriesRefreshing}
/>
<Button variant="primary" onClick={() => draftFrom()}>
create flow