mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-04 12:34:14 +01:00
improve transaction list performance (#3082)
* improve transaction list performance * fix "no transactions" placeholder positioning * format
This commit is contained in:
@@ -327,7 +327,7 @@ abstract class DashboardViewModelBase with Store {
|
||||
} catch (_) {}
|
||||
}
|
||||
return length * confirmations;
|
||||
}, _transactionDisposerCallback);
|
||||
}, _transactionDisposerCallback, delay: 300);
|
||||
|
||||
if (hasSilentPayments) {
|
||||
silentPaymentsScanningActive = bitcoin!.getScanningActive(wallet);
|
||||
@@ -481,13 +481,23 @@ abstract class DashboardViewModelBase with Store {
|
||||
}
|
||||
// printV("Transaction disposer callback (relevantTxs: ${relevantTxs.length} current: ${transactions.length})");
|
||||
|
||||
transactions.clear();
|
||||
transactions.addAll(relevantTxs.map((tx) => TransactionListItem(
|
||||
transaction: tx,
|
||||
balanceViewModel: balanceViewModel,
|
||||
appStore: appStore,
|
||||
key: ValueKey('${wallet.type.name}_transaction_history_item_${tx.id}_key'),
|
||||
)));
|
||||
final newTransactions = relevantTxs
|
||||
.map((tx) => TransactionListItem(
|
||||
transaction: tx,
|
||||
balanceViewModel: balanceViewModel,
|
||||
appStore: appStore,
|
||||
key: ValueKey('${wallet.type.name}_transaction_history_item_${tx.id}_key'),
|
||||
))
|
||||
.where((item) => !transactions.contains(item));
|
||||
|
||||
transactions.addAll(newTransactions);
|
||||
// transactions.clear();
|
||||
// transactions.addAll(relevantTxs.map((tx) => TransactionListItem(
|
||||
// transaction: tx,
|
||||
// balanceViewModel: balanceViewModel,
|
||||
// appStore: appStore,
|
||||
// key: ValueKey('${wallet.type.name}_transaction_history_item_${tx.id}_key'),
|
||||
// )));
|
||||
} finally {
|
||||
_isTransactionDisposerCallbackRunning = false;
|
||||
}
|
||||
@@ -1252,7 +1262,7 @@ abstract class DashboardViewModelBase with Store {
|
||||
} catch (_) {}
|
||||
}
|
||||
return length * confirmations;
|
||||
}, _transactionDisposerCallback);
|
||||
}, _transactionDisposerCallback, delay: 300);
|
||||
}
|
||||
|
||||
@action
|
||||
|
||||
@@ -289,4 +289,12 @@ class TransactionListItem extends ActionListItem with Keyable {
|
||||
|
||||
@override
|
||||
DateTime get date => transaction.date;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (other is TransactionListItem) {
|
||||
return other.transaction.txHash == transaction.txHash;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user