fix(ui): return null when default account ID is stale instead of falling back to first account

This commit is contained in:
ted
2026-03-24 19:27:56 -07:00
committed by Peter Steinberger
parent dc85235bf0
commit 4d41b8664c

View File

@@ -29,10 +29,9 @@ export function resolveChannelConfigured(key: ChannelKey, props: ChannelsProps):
const accounts = snapshot?.channelAccounts?.[key] ?? [];
const defaultAccountId = snapshot?.channelDefaultAccountId?.[key];
const defaultAccount =
(defaultAccountId
? accounts.find((account) => account.accountId === defaultAccountId)
: undefined) ?? accounts[0];
const defaultAccount = defaultAccountId
? accounts.find((account) => account.accountId === defaultAccountId)
: accounts[0];
if (typeof defaultAccount?.configured === "boolean") {
return defaultAccount.configured;