perf(agent-list): limit sidebar to 15 agents for fast rendering

Agents requiring attention are sorted to the top before slicing.

🤖 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-04 10:22:00 +07:00
parent 2a44b08d4b
commit 9c09f32dca

View File

@@ -20,14 +20,16 @@ export function AgentList({ agents, isRefreshing = false, onRefresh, selectedAge
const pathname = usePathname();
const [actionAgent, setActionAgent] = useState<AggregatedAgent | null>(null);
// Sort agents with requires attention at the top
// Sort agents with requires attention at the top, limit to 15 for fast rendering
const sortedAgents = useMemo(() => {
return [...agents].sort((a, b) => {
// Requires attention first
if (a.requiresAttention && !b.requiresAttention) return -1;
if (!a.requiresAttention && b.requiresAttention) return 1;
return 0;
});
return [...agents]
.sort((a, b) => {
// Requires attention first
if (a.requiresAttention && !b.requiresAttention) return -1;
if (!a.requiresAttention && b.requiresAttention) return 1;
return 0;
})
.slice(0, 15);
}, [agents]);
// Get the methods for the specific server