commit d16a62de5809a46688b8ffc8671cf5d7ecc95e87 parent 38f05f65601935feb92bfd513ca482db19c6d095 Author: Marc Stibane <marc@taler.net> Date: Fri, 14 Aug 2026 20:06:56 +0200 AI: guard deposit balance-picker syncs when balance changes while in tx history Diffstat:
| M | TalerWallet1/Views/Actions/Banking/DepositAmountAction.swift | | | 9 | +++++++-- |
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/TalerWallet1/Views/Actions/Banking/DepositAmountAction.swift b/TalerWallet1/Views/Actions/Banking/DepositAmountAction.swift @@ -45,8 +45,13 @@ struct DepositAmountAction: View { } else { balance = Balance.firstwithDeposit(balances) } - if let balance { - balanceIndex = balances.firstIndex(of: balance) ?? 0 + // selectedBalance is a snapshot taken when the transaction list appeared, so its + // amounts may already be stale - match on the scope instead of the whole value, + // otherwise the picker would show balances[0] while we deposit from another scope. + if let balance, + let index = balances.firstIndex(where: { $0.scopeInfo == balance.scopeInfo }) { + balanceIndex = index + self.balance = balances[index] // refresh the snapshot } else { balanceIndex = 0 balance = balances.isEmpty ? nil : balances[0]