From f88a7e3979c4f8512f602d5a69a51eafa00e9ebf Mon Sep 17 00:00:00 2001 From: lorretheboy Date: Wed, 8 Jul 2026 12:29:56 -0500 Subject: [PATCH 1/2] Fix: return home URL with backTo param for invalid reportID in getRoute --- src/ROUTES.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index cc47233bd8e0..aea62753421c 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -1579,6 +1579,7 @@ const ROUTES = { getRoute: (reportID: string | undefined, reportActionID?: string, referrer?: string, backTo?: string) => { if (!reportID) { Log.warn('Invalid reportID is used to build the REPORT_WITH_ID route'); + return getUrlWithBackToParam(ROUTES.HOME, backTo); } const baseRoute = reportActionID ? (`r/${reportID}/${reportActionID}` as const) : (`r/${reportID}` as const); From bee284fd0c8af54249f5d7cdeeb16fbf47bea1ec Mon Sep 17 00:00:00 2001 From: lorretheboy Date: Fri, 10 Jul 2026 03:16:39 -0500 Subject: [PATCH 2/2] fix: test --- config/eslint/eslint.seatbelt.tsv | 2 +- tests/unit/navigateAfterOnboardingTest.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/eslint/eslint.seatbelt.tsv b/config/eslint/eslint.seatbelt.tsv index fb1b04d4d4c0..d18637e184b6 100644 --- a/config/eslint/eslint.seatbelt.tsv +++ b/config/eslint/eslint.seatbelt.tsv @@ -67,7 +67,7 @@ "../../src/Expensify.tsx" "react-hooks/set-state-in-effect" 1 "../../src/GlobalModals.tsx" "no-restricted-syntax" 2 "../../src/ONYXKEYS.ts" "no-restricted-syntax" 2 -"../../src/ROUTES.ts" "@typescript-eslint/no-deprecated/getUrlWithBackToParam" 110 +"../../src/ROUTES.ts" "@typescript-eslint/no-deprecated/getUrlWithBackToParam" 111 "../../src/ROUTES.ts" "@typescript-eslint/no-unsafe-type-assertion" 3 "../../src/TIMEZONES.ts" "@typescript-eslint/no-unsafe-type-assertion" 1 "../../src/components/AccountingConnectionConfirmationModal.tsx" "@typescript-eslint/no-deprecated/ConfirmModal" 1 diff --git a/tests/unit/navigateAfterOnboardingTest.ts b/tests/unit/navigateAfterOnboardingTest.ts index 312199815a36..634558a7f2d8 100644 --- a/tests/unit/navigateAfterOnboardingTest.ts +++ b/tests/unit/navigateAfterOnboardingTest.ts @@ -74,8 +74,11 @@ describe('navigateAfterOnboarding', () => { }); it('should not navigate to the admin room report if onboardingAdminsChatReportID is not provided on larger screens', () => { + const navigate = jest.spyOn(Navigation, 'navigate'); navigateAfterOnboarding(false, true, '', {}, undefined, undefined); - expect(Navigation.navigate).not.toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(undefined)); + // Without an admins chat report, we fall back to HOME to trigger guard evaluation instead of opening a report. + expect(navigate).not.toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(ONBOARDING_ADMINS_CHAT_REPORT_ID)); + expect(navigate).toHaveBeenCalledWith(ROUTES.HOME); }); it('should not navigate to last accessed report if it is a concierge chat on small screens', async () => {