diff --git a/packages/shared/components/modals/AccountSwitcher.svelte b/packages/shared/components/modals/AccountSwitcher.svelte index 49c2f90d17b..948f17ffdde 100644 --- a/packages/shared/components/modals/AccountSwitcher.svelte +++ b/packages/shared/components/modals/AccountSwitcher.svelte @@ -8,6 +8,7 @@ import { getAccountColor } from '@lib/profile' import { WalletAccount } from '@lib/typings/wallet' import { + accountSyncingQueueStore, isTransferring, selectedAccountStore, setSelectedAccount, @@ -28,7 +29,11 @@ showWarning(localize('notifications.participating')) } else { setSelectedAccount(accountId) - updateAccountSyncingQueue($selectedAccountStore) + + if ($accountSyncingQueueStore?.length > 1) { + updateAccountSyncingQueue($selectedAccountStore) + } + resetAccountRouter(false) } modal?.close() diff --git a/packages/shared/lib/wallet.ts b/packages/shared/lib/wallet.ts index d28057ae25d..4cbb53d797d 100644 --- a/packages/shared/lib/wallet.ts +++ b/packages/shared/lib/wallet.ts @@ -458,10 +458,11 @@ export function initializeAccountSyncingQueue(): void { } export function updateAccountSyncingQueue(account: WalletAccount): void { - if (!account) return + const accountSyncingQueue = get(accountSyncingQueueStore) + if (!account || !accountSyncingQueue) return // It can be assumed that if the account is not currently in the queue then it has already been synced. - const isAccountInSyncingQueue = get(accountSyncingQueueStore).some((_account) => _account.id === account.id) + const isAccountInSyncingQueue = accountSyncingQueue?.some((_account) => _account.id === account.id) if (!isAccountInSyncingQueue) return // If the account is already first in the queue then no need to update the queue. @@ -1424,11 +1425,11 @@ const calculateInitialAccountSyncOptions = (setupType: SetupType): AccountSyncOp case SetupType.Mnemonic: case SetupType.Stronghold: gapLimit = 25 - accountDiscoveryThreshold = 1 + accountDiscoveryThreshold = 2 break case SetupType.FireflyLedger: gapLimit = 10 - accountDiscoveryThreshold = 1 + accountDiscoveryThreshold = 2 break }