Watch
0
0
Fork
You've already forked hyperhive
0

swarm UI: key LinkedAccounts by hive and agent

Selecting another agent kept the previous agent's rows on screen until
the new fetch landed. Keying both mounts by hive/agent remounts the
component on an agent change; a version bump still refetches in place.

Refs #4855
This commit is contained in:
atlas 2026-10-02 20:11:16 +02:00
commit 4fd1380a5f
2 changed files with 5 additions and 0 deletions

View file

@ -394,6 +394,7 @@ export function AgentsPage() {
<> <>
{a.hive ? ( {a.hive ? (
<LinkedAccounts <LinkedAccounts
key={`${a.hive}/${a.name}`}
hive={a.hive} hive={a.hive}
agent={a.name} agent={a.name}
version={linkVersion} version={linkVersion}
@ -600,6 +601,7 @@ export function AgentsPage() {
<dd> <dd>
{detailTarget.hive ? ( {detailTarget.hive ? (
<LinkedAccounts <LinkedAccounts
key={`${detailTarget.hive}/${detailTarget.name}`}
hive={detailTarget.hive} hive={detailTarget.hive}
agent={detailTarget.name} agent={detailTarget.name}
version={linkVersion} version={linkVersion}

View file

@ -5,6 +5,9 @@
// Fetched on mount and again whenever `version` changes; `AgentsPage` bumps // Fetched on mount and again whenever `version` changes; `AgentsPage` bumps
// it when a link dialog closes, so an account linked there shows up without // it when a link dialog closes, so an account linked there shows up without
// waiting for a reload. // waiting for a reload.
//
// Its state belongs to one agent: callers key it by hive and agent, so
// switching agents remounts it instead of showing the previous agent's rows.
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js"; import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js";
import { Badge } from "@hive/shared/badge.js"; import { Badge } from "@hive/shared/badge.js";