From 457e18a117ffa1ee1a03ade823530cea0c3bcd22 Mon Sep 17 00:00:00 2001 From: "truph01 (via MelvinBot)" Date: Tue, 17 Mar 2026 10:28:46 +0000 Subject: [PATCH 1/4] Navigate to Home page instead of Inbox when clicking 'Go back to home page' on NotFoundPage The 'Go back to home page' link on the 404 page was using Navigation.goBackToHome() which navigates to ROUTES.INBOX (the chat list). Now that HOME and INBOX are separate tabs, override the onLinkPress in NotFoundPage to navigate to ROUTES.HOME (the actual Home dashboard). Co-authored-by: truph01 --- src/pages/ErrorPage/NotFoundPage.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/ErrorPage/NotFoundPage.tsx b/src/pages/ErrorPage/NotFoundPage.tsx index 9211571eb7c71..e6aa9553f3052 100644 --- a/src/pages/ErrorPage/NotFoundPage.tsx +++ b/src/pages/ErrorPage/NotFoundPage.tsx @@ -7,6 +7,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import Navigation from '@libs/Navigation/Navigation'; import useAbsentPageSpan from '@libs/telemetry/useAbsentPageSpan'; import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; type NotFoundPageProps = { onBackButtonPress?: () => void; @@ -31,6 +32,7 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe > Navigation.navigate(ROUTES.HOME)} onBackButtonPress={() => { if (!isReportRelatedPage || !isSmallScreenWidth) { onBackButtonPress(); From d1a16ad07d33e660fc493c617b38dbc55e9f96ec Mon Sep 17 00:00:00 2001 From: "truph01 (via MelvinBot)" Date: Wed, 18 Mar 2026 10:33:22 +0000 Subject: [PATCH 2/4] Fix: Use goBack instead of navigate to prevent 404 staying in history Navigation.navigate(ROUTES.HOME) was pushing HOME onto the navigation stack, leaving the 404 page in browser history. Using goBack(ROUTES.HOME) instead leverages the replace semantics in goUp(), removing the 404 from history before navigating to HOME. Co-authored-by: truph01 --- src/pages/ErrorPage/NotFoundPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/ErrorPage/NotFoundPage.tsx b/src/pages/ErrorPage/NotFoundPage.tsx index e6aa9553f3052..3ade4ba9eb327 100644 --- a/src/pages/ErrorPage/NotFoundPage.tsx +++ b/src/pages/ErrorPage/NotFoundPage.tsx @@ -32,7 +32,7 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe > Navigation.navigate(ROUTES.HOME)} + onLinkPress={() => Navigation.goBack(ROUTES.HOME)} onBackButtonPress={() => { if (!isReportRelatedPage || !isSmallScreenWidth) { onBackButtonPress(); From 2daa9f0c41f388e14db6f2a3ed075a406d93648f Mon Sep 17 00:00:00 2001 From: "truph01 (via MelvinBot)" Date: Wed, 18 Mar 2026 11:41:25 +0000 Subject: [PATCH 3/4] Use useRoute() to scope Home navigation to NOT_FOUND screen only Instead of always overriding onLinkPress, use useRoute() to detect when NotFoundPage is rendered as the SCREENS.NOT_FOUND screen and only then navigate to HOME. Other callers that render NotFoundPage inline keep their existing onLinkPress behavior. Co-authored-by: truph01 --- src/pages/ErrorPage/NotFoundPage.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/ErrorPage/NotFoundPage.tsx b/src/pages/ErrorPage/NotFoundPage.tsx index 3ade4ba9eb327..fe9a4ab2f177d 100644 --- a/src/pages/ErrorPage/NotFoundPage.tsx +++ b/src/pages/ErrorPage/NotFoundPage.tsx @@ -1,3 +1,4 @@ +import {useRoute} from '@react-navigation/native'; import React from 'react'; import type {FullPageNotFoundViewProps} from '@components/BlockingViews/FullPageNotFoundView'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; @@ -8,6 +9,7 @@ import Navigation from '@libs/Navigation/Navigation'; import useAbsentPageSpan from '@libs/telemetry/useAbsentPageSpan'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; +import SCREENS from '@src/SCREENS'; type NotFoundPageProps = { onBackButtonPress?: () => void; @@ -22,6 +24,8 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe const {isSmallScreenWidth} = useResponsiveLayout(); const topmostReportId = Navigation.getTopmostReportId(); const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${topmostReportId}`); + const route = useRoute(); + const isNotFoundScreen = route.name === SCREENS.NOT_FOUND; useAbsentPageSpan(); @@ -32,7 +36,6 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe > Navigation.goBack(ROUTES.HOME)} onBackButtonPress={() => { if (!isReportRelatedPage || !isSmallScreenWidth) { onBackButtonPress(); @@ -48,6 +51,7 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe }} // eslint-disable-next-line react/jsx-props-no-spreading {...fullPageNotFoundViewProps} + onLinkPress={isNotFoundScreen ? () => Navigation.goBack(ROUTES.HOME) : fullPageNotFoundViewProps.onLinkPress} /> ); From 6c2a31cb1d23e218755c4cbddd67ab94d25f2e87 Mon Sep 17 00:00:00 2001 From: "truph01 (via MelvinBot)" Date: Wed, 18 Mar 2026 11:49:21 +0000 Subject: [PATCH 4/4] Rename negated variable to fix ESLint no-negated-variables rule Rename isNotFoundScreen to isOnGenericErrorScreen to comply with the rulesdir/no-negated-variables ESLint rule. Co-authored-by: truph01 --- src/pages/ErrorPage/NotFoundPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/ErrorPage/NotFoundPage.tsx b/src/pages/ErrorPage/NotFoundPage.tsx index fe9a4ab2f177d..0de487bec12a7 100644 --- a/src/pages/ErrorPage/NotFoundPage.tsx +++ b/src/pages/ErrorPage/NotFoundPage.tsx @@ -25,7 +25,7 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe const topmostReportId = Navigation.getTopmostReportId(); const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${topmostReportId}`); const route = useRoute(); - const isNotFoundScreen = route.name === SCREENS.NOT_FOUND; + const isOnGenericErrorScreen = route.name === SCREENS.NOT_FOUND; useAbsentPageSpan(); @@ -51,7 +51,7 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe }} // eslint-disable-next-line react/jsx-props-no-spreading {...fullPageNotFoundViewProps} - onLinkPress={isNotFoundScreen ? () => Navigation.goBack(ROUTES.HOME) : fullPageNotFoundViewProps.onLinkPress} + onLinkPress={isOnGenericErrorScreen ? () => Navigation.goBack(ROUTES.HOME) : fullPageNotFoundViewProps.onLinkPress} /> );