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 05cb972212
commit e5811e75f1
3 changed files with 8 additions and 1 deletions

View File

@@ -704,7 +704,8 @@ export function AgentDetailView({ agentId, projectId, onClose, addToast, onChild
)}
{activeTab === "config" && (
<ConfigTab
<ConfigTab
key={agent.id}
agent={agent}
projectId={projectId}
addToast={addToast}

View File

@@ -1459,6 +1459,7 @@ export function AgentsView({ addToast, projectId, onOpenTaskLogs, agentOnboardin
{selectedAgentId ? (
<Suspense fallback={null}>
<AgentDetailView
key={selectedAgentId}
inline
showInlineBackButton={isMobileViewport}
agentId={selectedAgentId}