From 0adb14c6002d568a6ea759e72322198e5327fbeb Mon Sep 17 00:00:00 2001 From: OmarKoueifi Date: Mon, 3 Feb 2025 03:31:37 -0500 Subject: [PATCH] Prevent It's not here message when logging in #55721 --- src/libs/actions/Report.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index b77b8115cb59..024d23762aa1 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -68,6 +68,7 @@ import * as Localize from '@libs/Localize'; import Log from '@libs/Log'; import {registerPaginationConfig} from '@libs/Middleware/Pagination'; import Navigation, {navigationRef} from '@libs/Navigation/Navigation'; +import shouldOpenOnAdminRoom from '@libs/Navigation/shouldOpenOnAdminRoom'; import {isOnboardingFlowName} from '@libs/NavigationUtils'; import enhanceParameters from '@libs/Network/enhanceParameters'; import type {NetworkStatus} from '@libs/NetworkConnection'; @@ -2942,6 +2943,20 @@ function openReportFromDeepLink(url: string) { return; } + // Check if the report exists in the collection + const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; + // If the report does not exist, navigate to the last accessed report or Concierge chat + if (!report) { + const lastAccessedReportID = findLastAccessedReport(false, shouldOpenOnAdminRoom(), undefined, reportID)?.reportID; + if (lastAccessedReportID) { + const lastAccessedReportRoute = ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID); + Navigation.navigate(lastAccessedReportRoute, CONST.NAVIGATION.ACTION_TYPE.PUSH); + return; + } + navigateToConciergeChat(false, () => true, CONST.NAVIGATION.ACTION_TYPE.PUSH); + return; + } + Navigation.navigate(route as Route, CONST.NAVIGATION.ACTION_TYPE.PUSH); };