diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 65e9587c3fe7..feb0bb2880bd 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -106,7 +106,6 @@ function Expensify() { const [currentOnboardingPurposeSelected] = useOnyx(ONYXKEYS.ONBOARDING_PURPOSE_SELECTED, {canBeMissing: true}); const [currentOnboardingCompanySize] = useOnyx(ONYXKEYS.ONBOARDING_COMPANY_SIZE, {canBeMissing: true}); const [onboardingInitialPath] = useOnyx(ONYXKEYS.ONBOARDING_LAST_VISITED_PATH, {canBeMissing: true}); - const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false}); useDebugShortcut(); usePriorityMode(); @@ -223,12 +222,12 @@ function Expensify() { // If the app is opened from a deep link, get the reportID (if exists) from the deep link and navigate to the chat report Linking.getInitialURL().then((url) => { setInitialUrl(url as Route); - Report.openReportFromDeepLink(url ?? '', currentOnboardingPurposeSelected, currentOnboardingCompanySize, onboardingInitialPath, allReports); + Report.openReportFromDeepLink(url ?? '', currentOnboardingPurposeSelected, currentOnboardingCompanySize, onboardingInitialPath); }); // Open chat report from a deep link (only mobile native) Linking.addEventListener('url', (state) => { - Report.openReportFromDeepLink(state.url, currentOnboardingPurposeSelected, currentOnboardingCompanySize, onboardingInitialPath, allReports); + Report.openReportFromDeepLink(state.url, currentOnboardingPurposeSelected, currentOnboardingCompanySize, onboardingInitialPath); }); if (CONFIG.IS_HYBRID_APP) { HybridAppModule.onURLListenerAdded(); diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 852bd54787ae..cb2056f88eb5 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3370,7 +3370,6 @@ function openReportFromDeepLink( currentOnboardingPurposeSelected: OnyxEntry, currentOnboardingCompanySize: OnyxEntry, onboardingInitialPath: OnyxEntry, - reports: OnyxCollection, ) { const reportID = getReportIDFromLink(url); const isAuthenticated = hasAuthToken(); @@ -3452,7 +3451,7 @@ function openReportFromDeepLink( const navigateHandler = (reportParam?: OnyxEntry) => { // Check if the report exists in the collection - const report = reportParam ?? reports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; + const report = reportParam ?? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; // If the report does not exist, navigate to the last accessed report or Concierge chat if (reportID && (!report?.reportID || report.errorFields?.notFound)) { const lastAccessedReportID = findLastAccessedReport(false, shouldOpenOnAdminRoom(), undefined, reportID)?.reportID; @@ -3469,11 +3468,7 @@ function openReportFromDeepLink( }; // If we log with deeplink with reportID and data for this report is not available yet, // then we will wait for Onyx to completely merge data from OpenReport API with OpenApp API in AuthScreens - if ( - reportID && - !isAuthenticated && - (!reports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`] || !reports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.reportID) - ) { + if (reportID && !isAuthenticated && !allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]) { const reportConnection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, // eslint-disable-next-line rulesdir/prefer-early-return