Skip to content

A local-first personal finance app

sort schedule previews by date, then amount (#4452)

Matt Fiddamaneface19216cc
diff --git a/packages/loot-core/src/client/data-hooks/transactions.ts b/packages/loot-core/src/client/data-hooks/transactions.ts
index 85386db644..8fc9abf688 100644
--- a/packages/loot-core/src/client/data-hooks/transactions.ts
+++ b/packages/loot-core/src/client/data-hooks/transactions.ts
@@ -228,7 +228,9 @@ export function usePreviewTransactions(): UsePreviewTransactionsResult {
})
.flat()
.sort(
- (a, b) => parseDate(b.date).getTime() - parseDate(a.date).getTime(),
+ (a, b) =>
+ parseDate(b.date).getTime() - parseDate(a.date).getTime() ||
+ a.amount - b.amount,
);
}, [isSchedulesLoading, schedules, statuses, upcomingLength]);
diff --git a/upcoming-release-notes/4452.md b/upcoming-release-notes/4452.md
new file mode 100644
index 0000000000..5d8f34b986
--- /dev/null
+++ b/upcoming-release-notes/4452.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [matt-fidd]
+---
+
+Sort upcoming schedules by date then amount so deposits come before payments