From 90870c7563fe2c0c285d4f3982e08f261ebd896d Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 16 Jan 2023 17:17:35 -0600 Subject: [PATCH] wallet delete ui bugfix for desktop --- lib/db/main_db.dart | 22 +++++++++---------- .../my_stack_view/coin_wallets_table.dart | 1 + .../my_stack_view/wallet_summary_table.dart | 1 + 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/db/main_db.dart b/lib/db/main_db.dart index 1e8c710d3..be6a98089 100644 --- a/lib/db/main_db.dart +++ b/lib/db/main_db.dart @@ -110,13 +110,17 @@ class MainDB { // Future deleteWalletBlockchainData(String walletId) async { + final transactionCount = await getTransactions(walletId).count(); + final addressCount = await getAddresses(walletId).count(); + final utxoCount = await getUTXOs(walletId).count(); + final inputCount = await getInputs(walletId).count(); + final outputCount = await getOutputs(walletId).count(); + await isar.writeTxn(() async { const paginateLimit = 50; // transactions - for (int i = 0; - i < getTransactions(walletId).countSync(); - i += paginateLimit) { + for (int i = 0; i < transactionCount; i += paginateLimit) { final txns = await getTransactions(walletId) .offset(i) .limit(paginateLimit) @@ -126,9 +130,7 @@ class MainDB { } // addresses - for (int i = 0; - i < getAddresses(walletId).countSync(); - i += paginateLimit) { + for (int i = 0; i < addressCount; i += paginateLimit) { final addresses = await getAddresses(walletId) .offset(i) .limit(paginateLimit) @@ -138,7 +140,7 @@ class MainDB { } // utxos - for (int i = 0; i < getUTXOs(walletId).countSync(); i += paginateLimit) { + for (int i = 0; i < utxoCount; i += paginateLimit) { final utxos = await getUTXOs(walletId).offset(i).limit(paginateLimit).findAll(); await isar.utxos @@ -146,7 +148,7 @@ class MainDB { } // inputs - for (int i = 0; i < getInputs(walletId).countSync(); i += paginateLimit) { + for (int i = 0; i < inputCount; i += paginateLimit) { final inputs = await getInputs(walletId).offset(i).limit(paginateLimit).findAll(); await isar.inputs @@ -154,9 +156,7 @@ class MainDB { } // outputs - for (int i = 0; - i < getOutputs(walletId).countSync(); - i += paginateLimit) { + for (int i = 0; i < outputCount; i += paginateLimit) { final outputs = await getOutputs(walletId).offset(i).limit(paginateLimit).findAll(); await isar.outputs diff --git a/lib/pages_desktop_specific/my_stack_view/coin_wallets_table.dart b/lib/pages_desktop_specific/my_stack_view/coin_wallets_table.dart index 073ea73b4..c61708c70 100644 --- a/lib/pages_desktop_specific/my_stack_view/coin_wallets_table.dart +++ b/lib/pages_desktop_specific/my_stack_view/coin_wallets_table.dart @@ -40,6 +40,7 @@ class CoinWalletsTable extends ConsumerWidget { children: [ for (int i = 0; i < walletIds.length; i++) Column( + key: Key("${coin.name}_$runtimeType${walletIds[i]}_key"), children: [ if (i != 0) const SizedBox( diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart index 40a72f6e0..d638b3d04 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart @@ -37,6 +37,7 @@ class _WalletTableState extends ConsumerState { rows: [ for (int i = 0; i < providersByCoin.length; i++) Builder( + key: Key("${providersByCoin[i].key.name}_${runtimeType}_key"), builder: (context) { final providers = ref.watch(walletsChangeNotifierProvider.select( (value) => value