Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cw 855 transactions not cleared correctly when switching wallets #2040

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 29 additions & 25 deletions lib/view_model/dashboard/dashboard_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,8 @@ abstract class DashboardViewModelBase with Store {

ReactionDisposer? _onMoneroBalanceChangeReaction;

ReactionDisposer? _transactionDisposer;

@computed
bool get hasPowNodes => [WalletType.nano, WalletType.banano].contains(wallet.type);

Expand Down Expand Up @@ -682,32 +684,34 @@ abstract class DashboardViewModelBase with Store {
);
}

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<TransactionInfo> 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? tx) {
if (tx == null) {
return false;
}

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;
});
),
);
}
);
}

@action
Expand Down
Loading