Update dashboard_view_model.dart

Serhii committed Mar 7, 2025 at 14:48 UTC 8009ee061c02c71e09d7e8a90b30bbd849e73eb4
1 file changed +26 -25
lib/view_model/dashboard/dashboard_view_model.dart
+26 -25
@@ -253,33 +253,34 @@ abstract class DashboardViewModelBase with Store {
253 _checkMweb();
254 });
255
256 - connectMapToListWithTransform(
257 - appStore.wallet!.transactionHistory.transactions,
258 - transactions,
259 - (TransactionInfo? transaction) => TransactionListItem(
260 - transaction: transaction!,
261 - balanceViewModel: balanceViewModel,
262 - settingsStore: appStore.settingsStore,
263 - key: ValueKey(
264 - '${_wallet.type.name}_transaction_history_item_${transaction.id}_key',
265 - ),
266 - ), filter: (TransactionInfo? transaction) {
267 - if (transaction == null) {
268 - return false;
269 - }
256 + _transactionDisposer?.reaction.dispose();
257
271 - final wallet = _wallet;
272 - if (wallet.type == WalletType.monero) {
273 - return monero!.getTransactionInfoAccountId(transaction) ==
274 - monero!.getCurrentAccount(wallet).id;
275 - }
276 - if (wallet.type == WalletType.wownero) {
277 - return wow.wownero!.getTransactionInfoAccountId(transaction) ==
278 - wow.wownero!.getCurrentAccount(wallet).id;
279 - }
258 + _transactionDisposer = reaction(
259 + (_) => appStore.wallet!.transactionHistory.transactions.values.toList(),
260 + (List<TransactionInfo> txs) {
261
281 - return true;
282 - });
262 + transactions.clear();
263 +
264 + transactions.addAll(
265 + txs.where((tx) {
266 + if (wallet.type == WalletType.monero) {
267 + return monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id;
268 + }
269 + if (wallet.type == WalletType.wownero) {
270 + return wow.wownero!.getTransactionInfoAccountId(tx) == wow.wownero!.getCurrentAccount(wallet).id;
271 + }
272 + return true;
273 + }).map(
274 + (tx) => TransactionListItem(
275 + transaction: tx,
276 + balanceViewModel: balanceViewModel,
277 + settingsStore: appStore.settingsStore,
278 + key: ValueKey('${wallet.type.name}_transaction_history_item_${tx.id}_key'),
279 + ),
280 + ),
281 + );
282 + }
283 + );
284
285 if (hasSilentPayments) {
286 silentPaymentsScanningActive = bitcoin!.getScanningActive(wallet);