From 721e615d8655a8ac0254b582831367604c443076 Mon Sep 17 00:00:00 2001 From: Filip Solecki Date: Wed, 8 Jan 2025 12:53:30 +0100 Subject: [PATCH] Fix default value for inexistent reportID --- src/ROUTES.ts | 2 +- src/libs/Navigation/dismissModalWithReport.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index fd1796cc8d16..c7ad8f9163f0 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -296,7 +296,7 @@ const ROUTES = { REPORT: 'r', REPORT_WITH_ID: { route: 'r/:reportID?/:reportActionID?', - getRoute: (reportID: string, reportActionID?: string, referrer?: string) => { + getRoute: (reportID: string | number, reportActionID?: string, referrer?: string) => { const baseRoute = reportActionID ? (`r/${reportID}/${reportActionID}` as const) : (`r/${reportID}` as const); const referrerParam = referrer ? `?referrer=${encodeURIComponent(referrer)}` : ''; return `${baseRoute}${referrerParam}` as const; diff --git a/src/libs/Navigation/dismissModalWithReport.ts b/src/libs/Navigation/dismissModalWithReport.ts index fcc9221a5676..382e09937313 100644 --- a/src/libs/Navigation/dismissModalWithReport.ts +++ b/src/libs/Navigation/dismissModalWithReport.ts @@ -48,7 +48,7 @@ function dismissModalWithReport(targetReport: OnyxEntry, navigationRef: case SCREENS.CONCIERGE: // If we are not in the target report, we need to navigate to it after dismissing the modal if (targetReport?.reportID !== getTopmostReportId(state)) { - const reportState = getStateFromPath(ROUTES.REPORT_WITH_ID.getRoute(targetReport?.reportID ?? `${CONST.DEFAULT_NUMBER_ID}`)); + const reportState = getStateFromPath(ROUTES.REPORT_WITH_ID.getRoute(targetReport?.reportID ?? CONST.DEFAULT_NUMBER_ID)); const policyID = getPolicyIDFromState(state as State); const policyMemberAccountIDs = getPolicyEmployeeAccountIDs(policyID); const shouldOpenAllWorkspace = isEmptyObject(targetReport) ? true : !doesReportBelongToWorkspace(targetReport, policyMemberAccountIDs, policyID);