Fix name change bug causing agent tab switching

This commit is contained in:
akhisud3195 2025-07-11 19:13:40 +05:30
parent 99053c4360
commit 61b811bd35
2 changed files with 2 additions and 15 deletions

View file

@ -89,19 +89,6 @@ export function AgentConfig({
setLocalName(agent.name);
}, [agent.name]);
// Store active tab in URL hash to persist across re-renders
useEffect(() => {
const hash = window.location.hash.slice(1);
if (hash === 'instructions' || hash === 'configurations') {
setActiveTab(hash as TabType);
}
}, []);
const handleTabChange = (tab: TabType) => {
setActiveTab(tab);
window.location.hash = tab;
};
// Track changes in RAG datasources
useEffect(() => {
const currentSources = agent.ragDataSources || [];
@ -211,7 +198,7 @@ export function AgentConfig({
{(['instructions', 'configurations'] as TabType[]).map((tab) => (
<button
key={tab}
onClick={() => handleTabChange(tab)}
onClick={() => setActiveTab(tab)}
className={clsx(
"px-4 py-2 text-sm font-medium transition-colors relative",
activeTab === tab

View file

@ -1018,7 +1018,7 @@ export function WorkflowEditor({
projectTools={projectTools}
/>
{state.present.selection?.type === "agent" && <AgentConfig
key={state.present.selection.name}
key={`agent-${state.present.workflow.agents.findIndex(agent => agent.name === state.present.selection!.name)}`}
projectId={state.present.workflow.projectId}
workflow={state.present.workflow}
agent={state.present.workflow.agents.find((agent) => agent.name === state.present.selection!.name)!}