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

@ -28,12 +28,16 @@ import {
export function UserMenu({
whoamiUrl,
autheliaUrl,
onLogout,
}: {
// Where the signed-in user is asked for, on this page's own origin.
whoamiUrl: string;
// Authelia's base URL, for the settings and sign-out links; none when it
// is not known, and the menu then shows only the name.
autheliaUrl: string | null;
// Runs when "log out" is chosen, for a page to forget what it kept of this
// session.
onLogout?: () => void;
}) {
const [who, setWho] = useState<WhoAmI | null>(null);
const [open, setOpen] = useState(false);
@ -109,7 +113,10 @@ export function UserMenu({
class="user-menu-item"
href={links.logout}
role="menuitem"
onClick={() => setOpen(false)}
onClick={() => {
onLogout?.();
setOpen(false);
}}
>
log out
</a>