Skip to content

Commit 9150af4

Browse files
authored
Merge pull request Expensify#75448 from Burhan-Rashid/fix/75118_updated
fix: added default report fallback and text property when matching option is undefined
2 parents 04315c9 + 54c64aa commit 9150af4

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/pages/iou/request/step/IOURequestEditReportCommon.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ import usePolicyForMovingExpenses from '@hooks/usePolicyForMovingExpenses';
1818
import useReportTransactions from '@hooks/useReportTransactions';
1919
import Navigation from '@libs/Navigation/Navigation';
2020
import {canSubmitPerDiemExpenseFromWorkspace, getPersonalPolicy, isPolicyAdmin} from '@libs/PolicyUtils';
21-
import {canAddTransaction, getOutstandingReportsForUser, getPolicyName, isIOUReport, isOpenReport, isReportOwner, isSelfDM, sortOutstandingReportsBySelected} from '@libs/ReportUtils';
21+
import {
22+
canAddTransaction,
23+
getOutstandingReportsForUser,
24+
getPolicyName,
25+
getReportName,
26+
isIOUReport,
27+
isOpenReport,
28+
isReportOwner,
29+
isSelfDM,
30+
sortOutstandingReportsBySelected,
31+
} from '@libs/ReportUtils';
2232
import CONST from '@src/CONST';
2333
import ONYXKEYS from '@src/ONYXKEYS';
2434
import type {Route} from '@src/ROUTES';
@@ -173,11 +183,12 @@ function IOURequestEditReportCommon({
173183
.map((report) => {
174184
const matchingOption = options.reports.find((option) => option.reportID === report.reportID);
175185
return {
176-
...matchingOption,
186+
...(matchingOption ?? report),
177187
// We are shallow copying properties from matchingOption, so if it has a brickRoadIndicator, it will display RBR.
178188
// We set it to null here to prevent showing RBR for reports https://github.com/Expensify/App/issues/65960.
179189
brickRoadIndicator: null,
180190
alternateText: getPolicyName({report}) ?? matchingOption?.alternateText,
191+
text: getReportName(report),
181192
value: report.reportID,
182193
keyForList: report.reportID,
183194
isSelected: report.reportID === selectedReportID,

0 commit comments

Comments
 (0)