Skip to content

Commit 6c46ef3

Browse files
MelvinBotbernhardoj
andcommitted
Navigate to Home instead of Inbox in goBackToHome
goBackToHome() was navigating to ROUTES.INBOX despite its name and the "Go back to home page" button text. Update it to use ROUTES.HOME. Remove the now-redundant workaround in NotFoundPage that bypassed goBackToHome() for the generic error screen. Co-authored-by: Bernhard Owen Josephus <bernhardoj@users.noreply.github.com>
1 parent 76f15c5 commit 6c46ef3

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

src/libs/Navigation/Navigation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,15 +564,15 @@ function goBackToHome() {
564564
const isNarrowLayout = getIsNarrowLayout();
565565

566566
// This set the right split navigator.
567-
goBack(ROUTES.INBOX);
567+
goBack(ROUTES.HOME);
568568

569569
// We want to keep the report screen in the split navigator on wide layout.
570570
if (!isNarrowLayout) {
571571
return;
572572
}
573573

574574
// This set the right route in this split navigator.
575-
goBack(ROUTES.INBOX);
575+
goBack(ROUTES.HOME);
576576
}
577577

578578
/**

src/pages/ErrorPage/NotFoundPage.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {useRoute} from '@react-navigation/native';
21
import React from 'react';
32
import type {FullPageNotFoundViewProps} from '@components/BlockingViews/FullPageNotFoundView';
43
import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView';
@@ -8,8 +7,6 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
87
import Navigation from '@libs/Navigation/Navigation';
98
import useAbsentPageSpan from '@libs/telemetry/useAbsentPageSpan';
109
import ONYXKEYS from '@src/ONYXKEYS';
11-
import ROUTES from '@src/ROUTES';
12-
import SCREENS from '@src/SCREENS';
1310

1411
type NotFoundPageProps = {
1512
onBackButtonPress?: () => void;
@@ -24,9 +21,6 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe
2421
const {isSmallScreenWidth} = useResponsiveLayout();
2522
const topmostReportId = Navigation.getTopmostReportId();
2623
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${topmostReportId}`);
27-
const route = useRoute();
28-
const isOnGenericErrorScreen = route.name === SCREENS.NOT_FOUND;
29-
3024
useAbsentPageSpan();
3125

3226
return (
@@ -51,7 +45,7 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe
5145
}}
5246
// eslint-disable-next-line react/jsx-props-no-spreading
5347
{...fullPageNotFoundViewProps}
54-
onLinkPress={isOnGenericErrorScreen ? () => Navigation.goBack(ROUTES.HOME) : fullPageNotFoundViewProps.onLinkPress}
48+
onLinkPress={fullPageNotFoundViewProps.onLinkPress}
5549
/>
5650
</ScreenWrapper>
5751
);

0 commit comments

Comments
 (0)