Skip to content

Commit e5874da

Browse files
committed
refactor
1 parent 1ac77ae commit e5874da

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/libs/actions/Report.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3422,11 +3422,11 @@ function openReportFromDeepLink(url: string) {
34223422
return;
34233423
}
34243424

3425-
const navigateHandler = (found?: boolean) => {
3425+
const navigateHandler = (reportParam?: OnyxEntry<Report>) => {
34263426
// Check if the report exists in the collection
3427-
const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
3427+
const report = reportParam ?? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];
34283428
// If the report does not exist, navigate to the last accessed report or Concierge chat
3429-
if (!found && reportID && (!report || report.errorFields?.notFound)) {
3429+
if (reportID && (!report?.reportID || report.errorFields?.notFound)) {
34303430
const lastAccessedReportID = findLastAccessedReport(false, shouldOpenOnAdminRoom(), undefined, reportID)?.reportID;
34313431
if (lastAccessedReportID) {
34323432
const lastAccessedReportRoute = ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID);
@@ -3439,7 +3439,7 @@ function openReportFromDeepLink(url: string) {
34393439

34403440
Navigation.navigate(route as Route);
34413441
};
3442-
// If we log with deeplink with reportID and data for this report is not available yet,
3442+
// If we log with deeplink with reportID and data for this report is not available yet,
34433443
// then we will wait for Onyx to completely merge data from OpenReport API with OpenApp API in AuthScreens
34443444
if (reportID && !isAuthenticated && !allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]) {
34453445
const reportConnection = Onyx.connect({
@@ -3449,7 +3449,7 @@ function openReportFromDeepLink(url: string) {
34493449
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
34503450
if (report?.errorFields?.notFound || report?.reportID) {
34513451
Onyx.disconnect(reportConnection);
3452-
navigateHandler(!!report?.reportID);
3452+
navigateHandler(report);
34533453
}
34543454
},
34553455
});

0 commit comments

Comments
 (0)