wallet delete ui bugfix for desktop

This commit is contained in:
julian 2023-01-16 17:17:35 -06:00
parent 880c82ba72
commit 90870c7563
3 changed files with 13 additions and 11 deletions

View file

@ -110,13 +110,17 @@ class MainDB {
// //
Future<void> deleteWalletBlockchainData(String walletId) async { Future<void> 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 { await isar.writeTxn(() async {
const paginateLimit = 50; const paginateLimit = 50;
// transactions // transactions
for (int i = 0; for (int i = 0; i < transactionCount; i += paginateLimit) {
i < getTransactions(walletId).countSync();
i += paginateLimit) {
final txns = await getTransactions(walletId) final txns = await getTransactions(walletId)
.offset(i) .offset(i)
.limit(paginateLimit) .limit(paginateLimit)
@ -126,9 +130,7 @@ class MainDB {
} }
// addresses // addresses
for (int i = 0; for (int i = 0; i < addressCount; i += paginateLimit) {
i < getAddresses(walletId).countSync();
i += paginateLimit) {
final addresses = await getAddresses(walletId) final addresses = await getAddresses(walletId)
.offset(i) .offset(i)
.limit(paginateLimit) .limit(paginateLimit)
@ -138,7 +140,7 @@ class MainDB {
} }
// utxos // utxos
for (int i = 0; i < getUTXOs(walletId).countSync(); i += paginateLimit) { for (int i = 0; i < utxoCount; i += paginateLimit) {
final utxos = final utxos =
await getUTXOs(walletId).offset(i).limit(paginateLimit).findAll(); await getUTXOs(walletId).offset(i).limit(paginateLimit).findAll();
await isar.utxos await isar.utxos
@ -146,7 +148,7 @@ class MainDB {
} }
// inputs // inputs
for (int i = 0; i < getInputs(walletId).countSync(); i += paginateLimit) { for (int i = 0; i < inputCount; i += paginateLimit) {
final inputs = final inputs =
await getInputs(walletId).offset(i).limit(paginateLimit).findAll(); await getInputs(walletId).offset(i).limit(paginateLimit).findAll();
await isar.inputs await isar.inputs
@ -154,9 +156,7 @@ class MainDB {
} }
// outputs // outputs
for (int i = 0; for (int i = 0; i < outputCount; i += paginateLimit) {
i < getOutputs(walletId).countSync();
i += paginateLimit) {
final outputs = final outputs =
await getOutputs(walletId).offset(i).limit(paginateLimit).findAll(); await getOutputs(walletId).offset(i).limit(paginateLimit).findAll();
await isar.outputs await isar.outputs

View file

@ -40,6 +40,7 @@ class CoinWalletsTable extends ConsumerWidget {
children: [ children: [
for (int i = 0; i < walletIds.length; i++) for (int i = 0; i < walletIds.length; i++)
Column( Column(
key: Key("${coin.name}_$runtimeType${walletIds[i]}_key"),
children: [ children: [
if (i != 0) if (i != 0)
const SizedBox( const SizedBox(

View file

@ -37,6 +37,7 @@ class _WalletTableState extends ConsumerState<WalletSummaryTable> {
rows: [ rows: [
for (int i = 0; i < providersByCoin.length; i++) for (int i = 0; i < providersByCoin.length; i++)
Builder( Builder(
key: Key("${providersByCoin[i].key.name}_${runtimeType}_key"),
builder: (context) { builder: (context) {
final providers = ref.watch(walletsChangeNotifierProvider.select( final providers = ref.watch(walletsChangeNotifierProvider.select(
(value) => value (value) => value