UI: nav tabs (Workspaces / + New / Providers) don't re-render the view on switch #1
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lz/agent-nexus#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
Clicking the Providers tab from Workspaces correctly switches to the providers view. Clicking Workspaces afterwards leaves the providers view on screen — the workspaces list never renders. Same problem in the other direction with + New. The active-tab highlight in the nav does move, so the click handler fires; only the view body fails to repaint.
Reproduce
Likely cause
nexus/web/src/views/workers.ts(post-redesign, diff-based renderer) caches module-level state across calls:The intent was to keep
shellRootstable across the 10s poll so the section header isn't rewritten and so per-workspace cards survive incardSlots. But when the user navigates Providers → Workspaces,renderConnectionshas already doneroot.innerHTML = …on the sameappEl()and discarded the workspaces shell. On return,shellRoot === rootis still true (same DOM node),listElis still a reference but its element was detached by the providers render, so the early-return path skips rebuilding the shell — yetlistElno longer lives insideroot. Net effect: the section header / list container exist as orphan nodes in memory, the visible DOM still shows providers, and the diff loop appends new cards into a detached tree.The same trap may apply to
cardSlots(entries still satisfyslot.el.isConnected === falseafter navigation away and back, depending on which check runs first). Need to verify against the actual paths.Fix sketch
Treat any view-switch as a "drop my cached state". Either:
main.tssetView, reset module-level state in the views that have caches (workers.tsexports aresetWorkersView()hook). Simple, explicit.renderWorkers, checkshellRoot && shellRoot.parentElement === root.parentElement && listEl?.isConnected. If any fail, drop the cache and rebuild the shell. Slightly more defensive.Same audit needed for
nexus/web/src/views/sessions.tswhich keeps aWeakMap<HTMLElement, MountState>— the WeakMap key is the mount node, which is freed when navigation discards it, so this one should self-clean. Worth verifying.Reference
nexus/web/src/views/workers.ts,nexus/web/src/main.ts,nexus/web/src/views/sessions.ts.