Skip to content

A local-first personal finance app

Fix Sorting/Balance interactions (#1406)

Neil2c69af21493e
diff --git a/packages/desktop-client/src/components/accounts/Account.js b/packages/desktop-client/src/components/accounts/Account.js
index d9526f8f46..3d646d6585 100644
--- a/packages/desktop-client/src/components/accounts/Account.js
+++ b/packages/desktop-client/src/components/accounts/Account.js
@@ -1047,13 +1047,13 @@ class AccountInternal extends PureComponent {
},
() => {
this.fetchTransactions();
-
- if (this.state.sort.length !== 0) {
- this.applySort();
- }
},
);
}
+
+ if (this.state.sort.length !== 0) {
+ this.applySort();
+ }
};
applySort = (field, ascDesc, prevField, prevAscDesc) => {
@@ -1217,6 +1217,7 @@ class AccountInternal extends PureComponent {
showEmptyMessage={showEmptyMessage}
balanceQuery={balanceQuery}
canCalculateBalance={this.canCalculateBalance}
+ isSorted={this.state.sort.length !== 0}
reconcileAmount={reconcileAmount}
search={this.state.search}
filters={this.state.filters}
@@ -1265,7 +1266,7 @@ class AccountInternal extends PureComponent {
categoryGroups={categoryGroups}
payees={payees}
balances={allBalances}
- showBalances={showBalances}
+ showBalances={!!allBalances}
showCleared={showCleared}
showAccount={
!accountId ||
@@ -1297,6 +1298,9 @@ class AccountInternal extends PureComponent {
</View>
) : null
}
+ onSort={this.onSort}
+ sortField={this.state.sort.field}
+ ascDesc={this.state.sort.ascDesc}
onChange={this.onTransactionsChange}
onRefetch={this.refetchTransactions}
onRefetchUpToRow={row =>
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.js b/packages/desktop-client/src/components/transactions/TransactionsTable.js
index 5664a95077..23e84f06e3 100644
--- a/packages/desktop-client/src/components/transactions/TransactionsTable.js
+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.js
@@ -363,7 +363,7 @@ const TransactionHeader = memo(
}
/>
{showBalance && <Cell value="Balance" width={88} textAlign="right" />}
- {showCleared && <Field width={30} truncate={false} />}
+ {showCleared && <Field width={23} truncate={false} />}
<Cell value="" width={5 + scrollWidth ?? 0} />
</Row>
);
diff --git a/upcoming-release-notes/1406.md b/upcoming-release-notes/1406.md
new file mode 100644
index 0000000000..c295b978a2
--- /dev/null
+++ b/upcoming-release-notes/1406.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [carkom]
+---
+
+Fix missed lines from previous merge that broke sorting.
\ No newline at end of file