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

@@ -22,11 +22,11 @@ interface AgentsState {
function applySnapshot(snapshot: AgentsSnapshot | undefined) {
return snapshot ? {
agents: snapshot.agents,
defaultAgentId: snapshot.defaultAgentId,
configuredChannelTypes: snapshot.configuredChannelTypes,
channelOwners: snapshot.channelOwners,
channelAccountOwners: snapshot.channelAccountOwners,
agents: snapshot.agents ?? [],
defaultAgentId: snapshot.defaultAgentId ?? 'main',
configuredChannelTypes: snapshot.configuredChannelTypes ?? [],
channelOwners: snapshot.channelOwners ?? {},
channelAccountOwners: snapshot.channelAccountOwners ?? {},
} : {};
}