diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 2834be0e1..d070b2ff9 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -253,33 +253,34 @@ abstract class DashboardViewModelBase with Store { _checkMweb(); }); - connectMapToListWithTransform( - appStore.wallet!.transactionHistory.transactions, - transactions, - (TransactionInfo? transaction) => TransactionListItem( - transaction: transaction!, - balanceViewModel: balanceViewModel, - settingsStore: appStore.settingsStore, - key: ValueKey( - '${_wallet.type.name}_transaction_history_item_${transaction.id}_key', + _transactionDisposer?.reaction.dispose(); + + _transactionDisposer = reaction( + (_) => appStore.wallet!.transactionHistory.transactions.values.toList(), + (List txs) { + + transactions.clear(); + + transactions.addAll( + txs.where((tx) { + if (wallet.type == WalletType.monero) { + return monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id; + } + if (wallet.type == WalletType.wownero) { + return wow.wownero!.getTransactionInfoAccountId(tx) == wow.wownero!.getCurrentAccount(wallet).id; + } + return true; + }).map( + (tx) => TransactionListItem( + transaction: tx, + balanceViewModel: balanceViewModel, + settingsStore: appStore.settingsStore, + key: ValueKey('${wallet.type.name}_transaction_history_item_${tx.id}_key'), ), - ), filter: (TransactionInfo? transaction) { - if (transaction == null) { - return false; - } - - final wallet = _wallet; - if (wallet.type == WalletType.monero) { - return monero!.getTransactionInfoAccountId(transaction) == - monero!.getCurrentAccount(wallet).id; - } - if (wallet.type == WalletType.wownero) { - return wow.wownero!.getTransactionInfoAccountId(transaction) == - wow.wownero!.getCurrentAccount(wallet).id; - } - - return true; - }); + ), + ); + } + ); if (hasSilentPayments) { silentPaymentsScanningActive = bitcoin!.getScanningActive(wallet);