From f037b4aedf7a79b2c3bb11b91622c360fa1e7841 Mon Sep 17 00:00:00 2001 From: George Ef Date: Sun, 3 Nov 2024 11:08:20 +0100 Subject: [PATCH] fix account in JournalView --- MMEX/View/Journal/JournalView.swift | 6 ++++-- MMEX/ViewModel/List/ScheduledList.swift | 1 + MMEX/ViewModel/List/TransactionList.swift | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/MMEX/View/Journal/JournalView.swift b/MMEX/View/Journal/JournalView.swift index 05236fc..788ecbc 100644 --- a/MMEX/View/Journal/JournalView.swift +++ b/MMEX/View/Journal/JournalView.swift @@ -69,8 +69,10 @@ struct JournalView: View { } } .onAppear { - Task { await vm.loadTransactionList() } - accountId = (vm.infotableList.defaultAccountId.readyValue ?? nil) ?? DataId.void + Task { + await vm.loadTransactionList() + accountId = (vm.infotableList.defaultAccountId.readyValue ?? nil) ?? DataId.void + } viewModel.loadTransactions(for: accountId) viewModel.loadAccounts() viewModel.loadCategories() diff --git a/MMEX/ViewModel/List/ScheduledList.swift b/MMEX/ViewModel/List/ScheduledList.swift index 76c16af..8f782c6 100644 --- a/MMEX/ViewModel/List/ScheduledList.swift +++ b/MMEX/ViewModel/List/ScheduledList.swift @@ -26,6 +26,7 @@ extension ViewModel { load(&taskGroup, keyPath: \Self.scheduledList.used), // auxiliary load(&taskGroup, keyPath: \Self.infotableList.baseCurrencyId), + load(&taskGroup, keyPath: \Self.infotableList.defaultAccountId), load(&taskGroup, keyPath: \Self.infotableList.categoryDelimiter), load(&taskGroup, keyPath: \Self.currencyList.info), load(&taskGroup, keyPath: \Self.accountList.data), diff --git a/MMEX/ViewModel/List/TransactionList.swift b/MMEX/ViewModel/List/TransactionList.swift index e23090b..e1f9949 100644 --- a/MMEX/ViewModel/List/TransactionList.swift +++ b/MMEX/ViewModel/List/TransactionList.swift @@ -26,6 +26,7 @@ extension ViewModel { load(&taskGroup, keyPath: \Self.transactionList.used), // auxiliary load(&taskGroup, keyPath: \Self.infotableList.baseCurrencyId), + load(&taskGroup, keyPath: \Self.infotableList.defaultAccountId), load(&taskGroup, keyPath: \Self.infotableList.categoryDelimiter), load(&taskGroup, keyPath: \Self.currencyList.info), load(&taskGroup, keyPath: \Self.accountList.data),