Skip to content

Commit a870f7c

Browse files
committed
feat(wallet-core): update non-blockbook accounts only if visible in sidebar
1 parent fd5fbfb commit a870f7c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

suite-common/wallet-core/src/blockchain/blockchainThunks.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createThunk } from '@suite-common/redux-utils';
22
import {
33
getNetworkOptional,
4+
isBlockbookBasedNetwork,
45
isNetworkSymbol,
56
networksCollection,
67
NetworkSymbol,
@@ -335,9 +336,14 @@ export const syncAccountsWithBlockchainThunk = createThunk(
335336
// First clear, to cancel last planned sync
336337
tryClearTimeout(blockchain[symbol].syncTimeout);
337338

339+
// non-blockbook networks will not update periodically if not visible in UI (sidebar)
340+
const visibleAccounts = findAccountsByNetwork(symbol, accounts).filter(
341+
account => isBlockbookBasedNetwork(symbol) || account.visible,
342+
);
343+
338344
await Promise.all(
339-
findAccountsByNetwork(symbol, accounts).map(a =>
340-
dispatch(fetchAndUpdateAccountThunk({ accountKey: a.key })),
345+
visibleAccounts.map(account =>
346+
dispatch(fetchAndUpdateAccountThunk({ accountKey: account.key })),
341347
),
342348
);
343349

0 commit comments

Comments
 (0)