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

Fix trip details RHP opens instead of not here page when opening invalid trip link #54869

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/pages/Travel/TripDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function TripDetailsPage({route}: TripDetailsPageProps) {

Copy link
Contributor

Choose a reason for hiding this comment

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

Please ignore. Marking for my K2 to pick this up.

const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${route.params.transactionID}`);
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID ?? '-1'}`);
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID ?? '-1'}`);
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID ?? CONST.DEFAULT_NUMBER_ID}`);
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID ?? CONST.DEFAULT_NUMBER_ID}`);

const tripID = ReportUtils.getTripIDFromTransactionParentReportID(parentReport?.reportID);
const reservationType = transaction?.receipt?.reservationList?.at(route.params.reservationIndex ?? 0)?.type;
Expand All @@ -67,7 +67,7 @@ function TripDetailsPage({route}: TripDetailsPageProps) {
>
<FullPageNotFoundView
shouldForceFullScreen
shouldShow={!canUseSpotnanaTravel && !NativeModules.HybridAppModule}
shouldShow={!reservation || (!canUseSpotnanaTravel && !NativeModules.HybridAppModule)}
>
<HeaderWithBackButton
title={reservationType ? `${translate(`travel.${reservationType}`)} ${translate('common.details').toLowerCase()}` : translate('common.details')}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Travel/TripSummaryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function TripSummaryPage({route}: TripSummaryPageProps) {
>
<FullPageNotFoundView
shouldForceFullScreen
shouldShow={!canUseSpotnanaTravel && !NativeModules.HybridAppModule}
shouldShow={reservationsData.length === 0 || (!canUseSpotnanaTravel && !NativeModules.HybridAppModule)}
>
<HeaderWithBackButton
title={translate(`travel.tripDetails`)}
Expand Down
Loading