Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/eslint/eslint.seatbelt.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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" 104
"../../src/ROUTES.ts" "@typescript-eslint/no-deprecated/getUrlWithBackToParam" 105
"../../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
Expand Down
1 change: 1 addition & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,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);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to add new use of getUrlWithBackToParam in this func as it is already used inside this one

}
const baseRoute = reportActionID ? (`r/${reportID}/${reportActionID}` as const) : (`r/${reportID}` as const);

Expand Down
5 changes: 4 additions & 1 deletion tests/unit/navigateAfterOnboardingTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Loading