fix: prevent "cannot read properties of undefined (reading 'map')" crash (#532)

This commit is contained in:
paisley
2026-03-16 19:52:01 +08:00
committed by GitHub
Unverified
parent 925fbab86d
commit 11e28a2cfa
6 changed files with 23 additions and 20 deletions

View File

@@ -182,7 +182,7 @@ export function Sidebar() {
}, [fetchAgents]);
const agentNameById = useMemo(
() => Object.fromEntries(agents.map((agent) => [agent.id, agent.name])),
() => Object.fromEntries((agents ?? []).map((agent) => [agent.id, agent.name])),
[agents],
);
const sessionBuckets: Array<{ key: SessionBucketKey; label: string; sessions: typeof sessions }> = [