Skip to content

A local-first personal finance app

fix first occurrence of some schedules moved after the weekend not showing in preview (#4256)

Matt Fiddamaned91fb1ef4a7
diff --git a/packages/loot-core/src/client/data-hooks/transactions.ts b/packages/loot-core/src/client/data-hooks/transactions.ts
index dd35d0de22..b1aff56721 100644
--- a/packages/loot-core/src/client/data-hooks/transactions.ts
+++ b/packages/loot-core/src/client/data-hooks/transactions.ts
@@ -174,7 +174,7 @@ export function usePreviewTransactions(): UsePreviewTransactionsResult {
const status = statuses.get(schedule.id);
const isRecurring = scheduleIsRecurring(dateConditions);
- const dates: string[] = [];
+ const dates: string[] = [schedule.next_date];
let day = d.startOfDay(parseDate(schedule.next_date));
if (isRecurring) {
while (day <= upcomingPeriodEnd) {
@@ -190,8 +190,6 @@ export function usePreviewTransactions(): UsePreviewTransactionsResult {
dates.push(nextDate);
day = parseDate(addDays(nextDate, 1));
}
- } else {
- dates.push(getNextDate(dateConditions, day));
}
if (status === 'paid') {
@@ -215,7 +213,7 @@ export function usePreviewTransactions(): UsePreviewTransactionsResult {
amount: getScheduledAmount(schedule._amount),
date,
schedule: schedule.id,
- forceUpcoming: schedules.length > 0 || status === 'paid',
+ forceUpcoming: date !== schedule.next_date || status === 'paid',
});
});
diff --git a/upcoming-release-notes/4256.md b/upcoming-release-notes/4256.md
new file mode 100644
index 0000000000..695ff457c1
--- /dev/null
+++ b/upcoming-release-notes/4256.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [matt-fidd]
+---
+
+Fix first occurrence of some schedules moved after the weekend not showing in preview