mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
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>
This commit is contained in:
@@ -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];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
|
||||
6
upcoming-release-notes/6569.md
Normal file
6
upcoming-release-notes/6569.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [majiayu000]
|
||||
---
|
||||
|
||||
Skip schedule prompt when editing transaction already linked to a schedule
|
||||
Reference in New Issue
Block a user