Preserve any agent tab when switching agents in sidebar

Remove hardcoded validTabs set and pass through whatever tab
segment is in the current URL. This makes tab preservation
work for all current and future agent tabs.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
dotta
2026-03-18 12:58:33 -05:00
parent 4f49c8a2b9
commit d84399aebe

View File

@@ -78,8 +78,6 @@ export function SidebarAgents() {
const activeAgentId = agentMatch?.[1] ?? null;
const activeTab = agentMatch?.[2] ?? null;
// Valid agent detail tabs — preserve across agent switches
const validTabs = new Set(["dashboard", "instructions", "prompts", "skills", "configuration", "configure", "budget", "runs"]);
return (
<Collapsible open={open} onOpenChange={setOpen}>
@@ -116,7 +114,7 @@ export function SidebarAgents() {
return (
<NavLink
key={agent.id}
to={activeTab && validTabs.has(activeTab) ? `${agentUrl(agent)}/${activeTab}` : agentUrl(agent)}
to={activeTab ? `${agentUrl(agent)}/${activeTab}` : agentUrl(agent)}
onClick={() => {
if (isMobile) setSidebarOpen(false);
}}