Skip to content

Commit

Permalink
queried cleared balance for tooltip (#1678)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaankhosla authored Sep 13, 2023
1 parent d835b11 commit b6100cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/desktop-client/src/components/accounts/Reconcile.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,20 @@ export function ReconcilingMessage({
}

export function ReconcileTooltip({ account, onReconcile, onClose }) {
let balance = useSheetValue(queries.accountBalance(account));
let balanceQuery = queries.accountBalance(account);
let clearedBalance = useSheetValue({
name: balanceQuery.name + '-cleared',
value: null,
query: balanceQuery.query.filter({ cleared: true }),
});
let format = useFormat();

function onSubmit(e) {
e.preventDefault();
let input = e.target.elements[0];
let amount = currencyToInteger(input.value);
if (amount != null) {
onReconcile(amount == null ? balance : amount);
onReconcile(amount == null ? clearedBalance : amount);
onClose();
} else {
input.select();
Expand All @@ -119,10 +124,10 @@ export function ReconcileTooltip({ account, onReconcile, onClose }) {
reconcile with:
</Text>
<form onSubmit={onSubmit}>
{balance != null && (
{clearedBalance != null && (
<InitialFocus>
<Input
defaultValue={format(balance, 'financial')}
defaultValue={format(clearedBalance, 'financial')}
style={{ margin: '7px 0' }}
/>
</InitialFocus>
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/1678.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [shaankhosla]
---

Fixes the reconciliation tooltip to use the cleared balance instead of the balance from all transactions

0 comments on commit b6100cf

Please sign in to comment.