Fix NE page lint errors, topology tree overflow and NE row height.

- NE page: derive the live connect-detail row instead of syncing it in an
  effect; one async path for topology deep links; memoize per-tag stats;
  re-seed the form dialog during render on open; move hop form state into
  lib/hopProxy so the component file only exports components.
- NE page: drop the "click a card to filter" hint; keep row actions on one
  line so rows no longer double in height.
- Topology tree: rows fit the sidebar, long names ellipsize with a tooltip,
  node counts stay visible; default sidebar width 260 -> 280.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
oliver 2026-10-13 01:51:37 +08:00
parent 8ecbb13f52
commit ec19102446
11 changed files with 109 additions and 93 deletions

View file

@ -89,16 +89,25 @@ export function ManagedNeFormDialog({
},
});
// Re-seed the form once each time the dialog opens (or switches row). Done
// during render — React's pattern for resetting state when inputs change.
const editingId = editing?.id ?? "";
const seedKey = open ? `open:${editingId}` : "";
const [seededKey, setSeededKey] = useState("");
if (seedKey !== seededKey) {
setSeededKey(seedKey);
if (open) {
const seed = editing ? formFromManagedNe(editing) : { ...emptyManagedNeForm(), ...(initialValues || {}) };
setForm(seed);
setPortDraft(String(seed.port));
setSubmitted(false);
}
}
// The mutation's error/result belongs to the previous opening.
const resetSave = saveMutation.reset;
useEffect(() => {
if (!open) return;
const seed = editing ? formFromManagedNe(editing) : { ...emptyManagedNeForm(), ...(initialValues || {}) };
setForm(seed);
setPortDraft(String(seed.port));
setSubmitted(false);
saveMutation.reset();
// eslint-disable-next-line react-hooks/exhaustive-deps -- seed once per open/create
}, [open, editingId]);
if (open) resetSave();
}, [open, editingId, resetSave]);
return (
<AppModalShell open={open} onClose={onClose} dismissible={!saveMutation.isPending} size="lg">