From 28dc971db0ab2cbb8db82a2484f5e69acab11274 Mon Sep 17 00:00:00 2001 From: wysinder Date: Mon, 7 Oct 2024 20:26:54 -0700 Subject: [PATCH 1/3] Show accurate balances when hiding reconciled transactions. --- .../desktop-client/src/components/accounts/Account.tsx | 6 ++++-- .../src/components/transactions/TransactionList.jsx | 4 +++- .../src/components/transactions/TransactionsTable.jsx | 8 +++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsx index 9e23555b190..54002fb74d2 100644 --- a/packages/desktop-client/src/components/accounts/Account.tsx +++ b/packages/desktop-client/src/components/accounts/Account.tsx @@ -486,8 +486,9 @@ 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 +1747,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 14fee62c9a5..0a7784e0472 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 36423d2b52f..5a05f3deffa 100644 --- a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx +++ b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx @@ -1809,6 +1809,12 @@ 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 +1988,7 @@ function TransactionTableInner({ navigator={tableNavigator} ref={tableRef} listContainerRef={listContainerRef} - items={props.transactions} + items={transactionsToRender} renderItem={renderRow} renderEmpty={renderEmpty} loadMore={props.loadMoreTransactions} From f2a6a082121cee8ab138f759b97bfaaa0ef6486e Mon Sep 17 00:00:00 2001 From: wysinder Date: Mon, 7 Oct 2024 20:46:22 -0700 Subject: [PATCH 2/3] Linting --- .../desktop-client/src/components/accounts/Account.tsx | 5 ++++- .../src/components/transactions/TransactionsTable.jsx | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsx index 54002fb74d2..92ab8a2f3e4 100644 --- a/packages/desktop-client/src/components/accounts/Account.tsx +++ b/packages/desktop-client/src/components/accounts/Account.tsx @@ -488,7 +488,10 @@ class AccountInternal extends PureComponent< // Filter out reconciled transactions if they are hidden // and we're not showing balances. - if (!this.state.showReconciled && (!this.state.showBalances || !this.canCalculateBalance())) { + if ( + !this.state.showReconciled && + (!this.state.showBalances || !this.canCalculateBalance()) + ) { query = query.filter({ reconciled: { $eq: false } }); } diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx index 5a05f3deffa..5dd3c6cbc8e 100644 --- a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx +++ b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx @@ -1811,8 +1811,11 @@ function TransactionTableInner({ // 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] + () => + props.showReconciled + ? props.transactions + : props.transactions.filter(t => !t.reconciled), + [props.transactions, props.showReconciled], ); const renderRow = ({ item, index, editing }) => { From 64b8d8724ed153981eaf26fc547a5cd322fbf657 Mon Sep 17 00:00:00 2001 From: wysinder Date: Tue, 8 Oct 2024 06:24:56 -0700 Subject: [PATCH 3/3] Add release notes --- upcoming-release-notes/3603.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 upcoming-release-notes/3603.md diff --git a/upcoming-release-notes/3603.md b/upcoming-release-notes/3603.md new file mode 100644 index 00000000000..4df7d555493 --- /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