Skip to content

A local-first personal finance app

queried cleared balance for tooltip (#1678)

Shaan Khoslab6100cfecd2b
diff --git a/packages/desktop-client/src/components/accounts/Reconcile.js b/packages/desktop-client/src/components/accounts/Reconcile.js
index 92615a9630..0b684d640a 100644
--- a/packages/desktop-client/src/components/accounts/Reconcile.js
+++ b/packages/desktop-client/src/components/accounts/Reconcile.js
@@ -96,7 +96,12 @@ 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) {
@@ -104,7 +109,7 @@ export function ReconcileTooltip({ account, onReconcile, onClose }) {
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();
@@ -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>
diff --git a/upcoming-release-notes/1678.md b/upcoming-release-notes/1678.md
new file mode 100644
index 0000000000..a3166d459e
--- /dev/null
+++ b/upcoming-release-notes/1678.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [shaankhosla]
+---
+
+Fixes the reconciliation tooltip to use the cleared balance instead of the balance from all transactions
\ No newline at end of file