Skip to content

A local-first personal finance app

Fixes #2703 - Fixes inaccurate running balance when hiding reconciled transactions (#3603)

wysinder71c208e444dc
diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsx
index 9e23555b19..92ab8a2f3e 100644
--- a/packages/desktop-client/src/components/accounts/Account.tsx
+++ b/packages/desktop-client/src/components/accounts/Account.tsx
@@ -486,8 +486,12 @@ class AccountInternal extends PureComponent<
this.paged.unsubscribe();
}
- // Filter out reconciled transactions if necessary.
- if (!this.state.showReconciled) {
+ // Filter out reconciled transactions if they are hidden
+ // and we're not showing balances.
+ if (
+ !this.state.showReconciled &&
+ (!this.state.showBalances || !this.canCalculateBalance())
+ ) {
query = query.filter({ reconciled: { $eq: false } });
}
@@ -1746,6 +1750,7 @@ class AccountInternal extends PureComponent<
payees={payees}
balances={allBalances}
showBalances={!!allBalances}
+ showReconciled={showReconciled}
showCleared={showCleared}
showAccount={
!accountId ||
diff --git a/packages/desktop-client/src/components/transactions/TransactionList.jsx b/packages/desktop-client/src/components/transactions/TransactionList.jsx
index 14fee62c9a..0a7784e047 100644
--- a/packages/desktop-client/src/components/transactions/TransactionList.jsx
+++ b/packages/desktop-client/src/components/transactions/TransactionList.jsx
@@ -68,6 +68,7 @@ export function TransactionList({
payees,
balances,
showBalances,
+ showReconciled,
showCleared,
showAccount,
headerContent,
@@ -203,8 +204,9 @@ export function TransactionList({
accounts={accounts}
categoryGroups={categoryGroups}
payees={payees}
- showBalances={showBalances}
balances={balances}
+ showBalances={showBalances}
+ showReconciled={showReconciled}
showCleared={showCleared}
showAccount={showAccount}
showCategory={true}
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx
index 36423d2b52..5dd3c6cbc8 100644
--- a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx
+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx
@@ -1809,6 +1809,15 @@ function TransactionTableInner({
}
}, [isAddingPrev, props.isAdding, newNavigator]);
+ // Don't render reconciled transactions if we're hiding them.
+ const transactionsToRender = useMemo(
+ () =>
+ props.showReconciled
+ ? props.transactions
+ : props.transactions.filter(t => !t.reconciled),
+ [props.transactions, props.showReconciled],
+ );
+
const renderRow = ({ item, index, editing }) => {
const {
transactions,
@@ -1982,7 +1991,7 @@ function TransactionTableInner({
navigator={tableNavigator}
ref={tableRef}
listContainerRef={listContainerRef}
- items={props.transactions}
+ items={transactionsToRender}
renderItem={renderRow}
renderEmpty={renderEmpty}
loadMore={props.loadMoreTransactions}
diff --git a/upcoming-release-notes/3603.md b/upcoming-release-notes/3603.md
new file mode 100644
index 0000000000..4df7d55549
--- /dev/null
+++ b/upcoming-release-notes/3603.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [wysinder]
+---
+
+Fixes inaccurate running balance when hiding reconciled transactions
\ No newline at end of file