fix(agent-list): close sidebar immediately on agent tap

Move onAgentSelect callback before navigation so the sidebar closes
instantly instead of waiting for the navigation to complete.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mohamed Boudra
2026-01-03 21:21:33 +07:00
parent 020d244b26
commit 344ef87b10

View File

@@ -59,6 +59,7 @@ export function AgentList({ agents, isRefreshing = false, onRefresh, selectedAge
});
const shouldReplace = pathname.startsWith("/agent/");
const navigate = shouldReplace ? router.replace : router.push;
onAgentSelect?.();
navigate({
pathname: "/agent/[serverId]/[agentId]",
params: {
@@ -66,7 +67,6 @@ export function AgentList({ agents, isRefreshing = false, onRefresh, selectedAge
agentId,
},
});
onAgentSelect?.();
},
[isActionSheetVisible, pathname, onAgentSelect]
);