Skip to content

Commit

Permalink
Merge pull request Expensify#54869 from software-mansion-labs/fix/tri…
Browse files Browse the repository at this point in the history
…p-details-not-found-view

Fix trip details RHP opens instead of not here page when opening invalid trip link
  • Loading branch information
carlosmiceli authored Jan 10, 2025
2 parents 3541c89 + 675d1d0 commit 6529181
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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) {

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

0 comments on commit 6529181

Please sign in to comment.