fix(dashboard): prevent cross-agent overwrite from stale Config tab autosave

Switching agents in the AgentsView split layout while on the Config tab
caused the autosave to write the previously-viewed agent's surface fields
(name, role, title, icon, model, skills) onto the newly-selected agent.
The Config tab's form state was initialized once at mount and never
resynced, while the master-detail layout reused the same component
instance across selections. Add key={selectedAgentId} on AgentDetailView
and key={agent.id} on ConfigTab so both remount with fresh state on every
agent transition.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-04 15:53:00 -07:00
parent 6be45ad78b
commit 082c62a6e2
3 changed files with 8 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@fusion/dashboard": patch
---
Fix a cross-agent overwrite bug in the Agents split view. The Config tab's form state was initialized once at mount and never resynced on `agent` change, while the master-detail layout reused the same `<AgentDetailView>` / `<ConfigTab>` instance across selections (no `key`). Switching agents while sitting on the Config tab made `hasChanges` evaluate true (stale form values vs. the newly loaded agent), and the 700ms autosave then wrote the previously-viewed agent's name/role/title/icon/model/skills onto the newly-selected agent's row. Adds `key={selectedAgentId}` to `<AgentDetailView>` and `key={agent.id}` to `<ConfigTab>` so both remount with fresh state on every agent transition.