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:
5
.changeset/fix-agent-config-cross-overwrite.md
Normal file
5
.changeset/fix-agent-config-cross-overwrite.md
Normal 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.
|
||||||
@@ -704,7 +704,8 @@ export function AgentDetailView({ agentId, projectId, onClose, addToast, onChild
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{activeTab === "config" && (
|
{activeTab === "config" && (
|
||||||
<ConfigTab
|
<ConfigTab
|
||||||
|
key={agent.id}
|
||||||
agent={agent}
|
agent={agent}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
addToast={addToast}
|
addToast={addToast}
|
||||||
|
|||||||
@@ -1459,6 +1459,7 @@ export function AgentsView({ addToast, projectId, onOpenTaskLogs, agentOnboardin
|
|||||||
{selectedAgentId ? (
|
{selectedAgentId ? (
|
||||||
<Suspense fallback={null}>
|
<Suspense fallback={null}>
|
||||||
<AgentDetailView
|
<AgentDetailView
|
||||||
|
key={selectedAgentId}
|
||||||
inline
|
inline
|
||||||
showInlineBackButton={isMobileViewport}
|
showInlineBackButton={isMobileViewport}
|
||||||
agentId={selectedAgentId}
|
agentId={selectedAgentId}
|
||||||
|
|||||||
Reference in New Issue
Block a user