Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Welcome message wrong link 33230 #33723

Merged
10 changes: 10 additions & 0 deletions src/libs/Navigation/AppNavigator/ReportScreenIDSetter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {useEffect} from 'react';
import {OnyxCollection, OnyxEntry, withOnyx} from 'react-native-onyx';
import usePermissions from '@hooks/usePermissions';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportUtils from '@libs/ReportUtils';
import * as App from '@userActions/App';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {Policy, Report, ReportMetadata} from '@src/types/onyx';
import type {ReportScreenWrapperProps} from './ReportScreenWrapper';

Expand Down Expand Up @@ -45,6 +47,14 @@ function ReportScreenIDSetter({route, reports, policies, navigation, isFirstTime
// Don't update if there is a reportID in the params already
if (route?.params?.reportID) {
App.confirmReadyToOpenApp();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for this line to be above this logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really, additional lines were removed.


const reportActionID = route?.params?.reportActionID;
const regexValidReportActionID = new RegExp(/^\d*$/);
if (reportActionID && !regexValidReportActionID.test(reportActionID)) {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(route?.params?.reportID));
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const reportActionID = route?.params?.reportActionID;
const regexValidReportActionID = new RegExp(/^\d*$/);
if (reportActionID && !regexValidReportActionID.test(reportActionID)) {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(route?.params?.reportID));
return;
}
const reportActionID = route?.params?.reportActionID;
const regexValidReportActionID = new RegExp(/^\d*$/);
if (reportActionID && !regexValidReportActionID.test(reportActionID)) {
navigation.setParams({reportActionID: ''});
}

Sorry, but this works better.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change to this?


return;
}

Expand Down
Loading