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:
co-authored by
Claude Opus 4.5
parent
2a44b08d4b
commit
9c09f32dca
@@ -20,14 +20,16 @@ export function AgentList({ agents, isRefreshing = false, onRefresh, selectedAge
|
|||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const [actionAgent, setActionAgent] = useState<AggregatedAgent | null>(null);
|
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(() => {
|
const sortedAgents = useMemo(() => {
|
||||||
return [...agents].sort((a, b) => {
|
return [...agents]
|
||||||
// Requires attention first
|
.sort((a, b) => {
|
||||||
if (a.requiresAttention && !b.requiresAttention) return -1;
|
// Requires attention first
|
||||||
if (!a.requiresAttention && b.requiresAttention) return 1;
|
if (a.requiresAttention && !b.requiresAttention) return -1;
|
||||||
return 0;
|
if (!a.requiresAttention && b.requiresAttention) return 1;
|
||||||
});
|
return 0;
|
||||||
|
})
|
||||||
|
.slice(0, 15);
|
||||||
}, [agents]);
|
}, [agents]);
|
||||||
|
|
||||||
// Get the methods for the specific server
|
// Get the methods for the specific server
|
||||||
|
|||||||
Reference in New Issue
Block a user