forked from farhoodlabs/paperclip
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:
@@ -78,8 +78,6 @@ export function SidebarAgents() {
|
|||||||
const activeAgentId = agentMatch?.[1] ?? null;
|
const activeAgentId = agentMatch?.[1] ?? null;
|
||||||
const activeTab = agentMatch?.[2] ?? 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 (
|
return (
|
||||||
<Collapsible open={open} onOpenChange={setOpen}>
|
<Collapsible open={open} onOpenChange={setOpen}>
|
||||||
@@ -116,7 +114,7 @@ export function SidebarAgents() {
|
|||||||
return (
|
return (
|
||||||
<NavLink
|
<NavLink
|
||||||
key={agent.id}
|
key={agent.id}
|
||||||
to={activeTab && validTabs.has(activeTab) ? `${agentUrl(agent)}/${activeTab}` : agentUrl(agent)}
|
to={activeTab ? `${agentUrl(agent)}/${activeTab}` : agentUrl(agent)}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (isMobile) setSidebarOpen(false);
|
if (isMobile) setSidebarOpen(false);
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user