Skip to content

A local-first personal finance app

fix: skip schedule prompt for transactions already linked to schedule (#6569)

lif2b8a15f51c45
diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx
index a4fb338a92..f36a3f18a4 100644
--- a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx
+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx
@@ -687,8 +687,9 @@ const TransactionEditInner = memo<TransactionEditInnerProps>(
const today = monthUtils.currentDay();
const isFuture = unserializedTransaction.date > today;
+ const isLinkedToSchedule = !!unserializedTransaction.schedule;
- if (isFuture) {
+ if (isFuture && !isLinkedToSchedule) {
const upcomingDays = getUpcomingDays(upcomingLength, today);
const daysUntilTransaction = monthUtils.differenceInCalendarDays(
unserializedTransaction.date,
@@ -798,8 +799,7 @@ const TransactionEditInner = memo<TransactionEditInnerProps>(
const onTotalAmountUpdate = useCallback(
(value: number) => {
if (transaction.amount !== value) {
- // @ts-expect-error - fix me
- onUpdateInner(transaction, 'amount', value.toString());
+ onUpdateInner(transaction, 'amount', value);
}
},
[onUpdateInner, transaction],
@@ -1435,8 +1435,7 @@ function TransactionEditUnconnected({
newTransaction[field] === 0 ||
newTransaction[field] === false
) {
- // @ts-expect-error - fix me
- newTransaction[field] = diff[field];
+ (newTransaction as Record<string, unknown>)[field] = diff[field];
}
});
diff --git a/packages/desktop-client/src/components/transactions/TransactionList.tsx b/packages/desktop-client/src/components/transactions/TransactionList.tsx
index 5ad7434e1f..798d271925 100644
--- a/packages/desktop-client/src/components/transactions/TransactionList.tsx
+++ b/packages/desktop-client/src/components/transactions/TransactionList.tsx
@@ -381,8 +381,13 @@ export function TransactionList({
newTransactions = realizeTempTransactions(newTransactions);
const parentTransaction = newTransactions.find(t => !t.is_child);
+ const isLinkedToSchedule = !!parentTransaction?.schedule;
- if (parentTransaction && isFutureTransaction(parentTransaction)) {
+ if (
+ parentTransaction &&
+ isFutureTransaction(parentTransaction) &&
+ !isLinkedToSchedule
+ ) {
const transactionWithSubtransactions = {
...parentTransaction,
subtransactions: newTransactions.filter(
@@ -440,7 +445,8 @@ export function TransactionList({
}
};
- if (isFutureTransaction(transaction)) {
+ const isLinkedToSchedule = !!transaction.schedule;
+ if (isFutureTransaction(transaction) && !isLinkedToSchedule) {
const originalTransaction = transactionsLatest.current.find(
t => t.id === transaction.id,
);
diff --git a/upcoming-release-notes/6569.md b/upcoming-release-notes/6569.md
new file mode 100644
index 0000000000..17b2539bec
--- /dev/null
+++ b/upcoming-release-notes/6569.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [majiayu000]
+---
+
+Skip schedule prompt when editing transaction already linked to a schedule