Skip to content
Snippets Groups Projects
Unverified Commit b6100cfe authored by Shaan Khosla's avatar Shaan Khosla Committed by GitHub
Browse files

queried cleared balance for tooltip (#1678)

parent d835b113
No related branches found
No related tags found
No related merge requests found
......@@ -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>
......
---
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment