Skip to content

Commit

Permalink
fix: last selected account id not found (#7572)
Browse files Browse the repository at this point in the history
  • Loading branch information
begonaalvarezd authored Oct 11, 2023
1 parent aec90b1 commit 6ffad61
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,14 @@ export async function login(loginOptions?: ILoginOptions): Promise<void> {
pollLedgerNanoStatus()
}

setSelectedAccount(lastUsedAccountIndex ?? get(activeAccounts)?.[0]?.index ?? null)
let initialSelectedAccountindex = get(activeAccounts)?.[0]?.index
if (
lastUsedAccountIndex &&
get(activeAccounts)?.find((_account) => _account.index === lastUsedAccountIndex)
) {
initialSelectedAccountindex = lastUsedAccountIndex
}
setSelectedAccount(initialSelectedAccountindex)
lastActiveAt.set(new Date())
loggedIn.set(true)
setTimeout(() => {
Expand Down

0 comments on commit 6ffad61

Please sign in to comment.