Skip to content

Commit e31e605

Browse files
committed
solution simply as it can be
1 parent 8cd20c0 commit e31e605

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/libs/actions/IOU.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3630,7 +3630,7 @@ function getTrackExpenseInformation(params: GetTrackExpenseInformationParams): T
36303630
transactionParams: {
36313631
amount: isExpenseReport(iouReport) ? -amount : amount,
36323632
currency,
3633-
reportID: shouldUseMoneyReport && iouReport ? iouReport.reportID : undefined,
3633+
reportID: shouldUseMoneyReport && iouReport ? iouReport.reportID : CONST.REPORT.UNREPORTED_REPORT_ID,
36343634
comment,
36353635
created,
36363636
merchant,

src/libs/actions/Transaction.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -595,15 +595,11 @@ function changeTransactionsReport(transactionIDs: string[], reportID: string) {
595595
const failureData: OnyxUpdate[] = [];
596596
const successData: OnyxUpdate[] = [];
597597

598-
// If a transaction doesn't have an assigned report, it is considered an unreported transaction,
599-
// so we can assign it the default ID equal to the Unreported report ID.
600-
const transactionsWithDefaultIds = transactions.map((transaction) => ({
601-
...transaction,
602-
reportID: transaction.reportID ?? CONST.REPORT.UNREPORTED_REPORT_ID,
603-
}));
604-
605-
transactionsWithDefaultIds.forEach((transaction) => {
598+
transactions.forEach((transaction) => {
606599
const oldIOUAction = getIOUActionForReportID(transaction.reportID, transaction.transactionID);
600+
if (!transaction.reportID) {
601+
return;
602+
}
607603

608604
const oldReportID = transaction.reportID;
609605
const oldReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${oldReportID}`];

src/pages/AddUnreportedExpense.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) {
3838
if (!transactions) {
3939
return [];
4040
}
41-
return Object.values(transactions || {}).filter((item) => item?.reportID === '0' || !item?.reportID);
41+
return Object.values(transactions || {}).filter((item) => item?.reportID === '0');
4242
}
4343

4444
const [transactions = []] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {

0 commit comments

Comments
 (0)