Fixed that BankListItem and BankAccountListItem didn't get updated on changes like balance changed or retrieved bank icon

This commit is contained in:
dankito 2020-09-25 00:40:40 +02:00
parent f03480945e
commit e8aee07b34
3 changed files with 17 additions and 2 deletions

View File

@ -70,6 +70,19 @@ extension KeychainPasswordItem {
}
extension IBankData {
var randomId: UUID { UUID() }
}
extension IBankAccount {
var randomId: UUID { UUID() }
}
extension BankData : Identifiable {
public var id: String { technicalId }

View File

@ -22,7 +22,8 @@ struct AccountsDialog: View {
Form {
AllBanksListItem(banks: data.banks)
ForEach(data.banks.sortedByDisplayIndex(), id: \.technicalId) { bank in
// if a constant id like \.technicalId is provided, list doesn't get updated on changes like balance changed or retrieved bank icon
ForEach(data.banksSorted, id: \.randomId) { bank in
BankListItem(bank: bank)
}

View File

@ -47,7 +47,8 @@ struct BankListItem : View {
}
ForEach(bank.accountsSorted, id: \.technicalId) { account in
// if a constant id like \.technicalId is provided, list doesn't get updated on changes e.g. when balance changes
ForEach(bank.accountsSorted, id: \.randomId) { account in
BankAccountListItem(account: account)
}
.padding(.leading, Styles.AccountsIconWidth + Styles.DefaultSpaceBetweenIconAndText)