fix: prevent "cannot read properties of undefined (reading 'map')" crash (#532)
This commit is contained in:
committed by
GitHub
Unverified
parent
925fbab86d
commit
11e28a2cfa
@@ -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 ?? {},
|
||||
} : {};
|
||||
}
|
||||
|
||||
|
||||
@@ -82,10 +82,10 @@ export const useProviderStore = create<ProviderState>((set, get) => ({
|
||||
const snapshot = await fetchProviderSnapshot();
|
||||
|
||||
set({
|
||||
statuses: snapshot.statuses,
|
||||
accounts: snapshot.accounts,
|
||||
vendors: snapshot.vendors,
|
||||
defaultAccountId: snapshot.defaultAccountId,
|
||||
statuses: snapshot.statuses ?? [],
|
||||
accounts: snapshot.accounts ?? [],
|
||||
vendors: snapshot.vendors ?? [],
|
||||
defaultAccountId: snapshot.defaultAccountId ?? null,
|
||||
loading: false
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user