From 2b8a15f51c45f0460d96c78029e9d37da5425cc0 Mon Sep 17 00:00:00 2001 From: lif <1835304752@qq.com> Date: Wed, 14 Jan 2026 04:20:29 +0800 Subject: [PATCH] fix: skip schedule prompt for transactions already linked to schedule (#6569) * fix: skip schedule prompt for transactions already linked to schedule When editing a future-dated transaction on mobile that is already linked to a schedule, the app was incorrectly showing the "convert to schedule" prompt. This was confusing since the transaction was already associated with a schedule. This change adds a check for `unserializedTransaction.schedule` to skip showing the schedule prompt if the transaction is already linked to a schedule. Fixes #6357 Signed-off-by: majiayu000 <1835304752@qq.com> * fix: resolve build and lint issues in TransactionEdit.tsx * docs: add release notes for PR #6569 * chore: remove duplicate release note file Signed-off-by: majiayu000 <1835304752@qq.com> * chore: rename release note file to match PR number Signed-off-by: majiayu000 <1835304752@qq.com> * fix: apply schedule prompt fix to desktop version Signed-off-by: majiayu000 <1835304752@qq.com> --------- Signed-off-by: majiayu000 <1835304752@qq.com> --- .../components/mobile/transactions/TransactionEdit.tsx | 9 ++++----- .../src/components/transactions/TransactionList.tsx | 10 ++++++++-- upcoming-release-notes/6569.md | 6 ++++++ 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 upcoming-release-notes/6569.md 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( 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( 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)[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