diff --git a/src/CONST.ts b/src/CONST.ts index dcef6d01f36c..201f95ae9f57 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -842,6 +842,8 @@ const CONST = { IOU: 'iou', TASK: 'task', INVOICE: 'invoice', + }, + UNSUPPORTED_TYPE: { PAYCHECK: 'paycheck', BILL: 'bill', }, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 5509b8f700b8..81a0125be15a 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5468,7 +5468,7 @@ function shouldReportBeInOptionList({ return false; } - if (report?.type === CONST.REPORT.TYPE.PAYCHECK || report?.type === CONST.REPORT.TYPE.BILL) { + if ((Object.values(CONST.REPORT.UNSUPPORTED_TYPE) as string[]).includes(report?.type ?? '')) { return false; } diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 37b9f3b881d9..2d609b7279a4 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -105,6 +105,9 @@ function getOrderedReportIDs( if (!report) { return; } + if ((Object.values(CONST.REPORT.UNSUPPORTED_TYPE) as string[]).includes(report?.type ?? '')) { + return; + } const reportActions = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`] ?? {}; const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '-1', report?.parentReportActionID ?? '-1'); const doesReportHaveViolations = OptionsListUtils.shouldShowViolations(report, betas ?? [], transactionViolations); diff --git a/tests/unit/SidebarFilterTest.ts b/tests/unit/SidebarFilterTest.ts index 1e0745916717..1c70993c8fad 100644 --- a/tests/unit/SidebarFilterTest.ts +++ b/tests/unit/SidebarFilterTest.ts @@ -283,11 +283,16 @@ xdescribe('Sidebar', () => { it('filter paycheck and bill report', () => { const report1: Report = { ...LHNTestUtils.getFakeReport(), - type: CONST.REPORT.TYPE.PAYCHECK, + type: CONST.REPORT.UNSUPPORTED_TYPE.PAYCHECK, }; const report2: Report = { ...LHNTestUtils.getFakeReport(), - type: CONST.REPORT.TYPE.BILL, + type: CONST.REPORT.UNSUPPORTED_TYPE.BILL, + errorFields: { + notFound: { + error: 'Report not found', + }, + }, }; const report3: Report = LHNTestUtils.getFakeReport(); LHNTestUtils.getDefaultRenderedSidebarLinks(report1.reportID);