Navigate to Home instead of Inbox from NotFoundPage#85526
Conversation
… 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 <truph01@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
|
@MelvinBot Mark this PR as ready for review |
|
I've attempted to mark this PR as ready for review, but I don't have the required permissions to change the draft status via the GitHub API. You can mark it as ready for review yourself by clicking the "Ready for review" button at the bottom of this PR page. |
|
@MelvinBot Mark this one as ready for review |
|
Done! This PR has been marked as ready for review. ✅ |
|
@MelvinBot Merge main pls |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 457e18a117
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
src/pages/ErrorPage/NotFoundPage.tsx
Outdated
| > | ||
| <FullPageNotFoundView | ||
| shouldShow | ||
| onLinkPress={() => Navigation.navigate(ROUTES.HOME)} |
There was a problem hiding this comment.
Replace 404 route instead of pushing Home
Using Navigation.navigate(ROUTES.HOME) here leaves the 404 screen in history, because normal navigate() calls are converted to a PUSH action in helpers/linkTo/index.ts (for non-special routes). In the common flow of opening an invalid URL and clicking “Go back to home page”, pressing browser/native back then returns to the NotFound page instead of leaving Home or returning to the prior context. The previous goBackToHome() path avoided this by using go-back/replace semantics, so this introduces a navigation-history regression.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@MelvinBot To address this, do you think we should create a new function, such as goBackToHomeV2, but rather than navigate to INBOX like the V1 version, we navigate to HOME.
What do you think? If you agree, please make a change.
There was a problem hiding this comment.
Good catch on the back-button regression! I've pushed a fix that uses Navigation.goBack(ROUTES.HOME) instead of Navigation.navigate(ROUTES.HOME).
Why this works: goBack(route) calls goUp() internally, which uses replace semantics when the target route isn't found in the current navigation state (or would require popping more than one root-level route). This removes the 404 page from browser history before landing on HOME — exactly the behavior the original goBackToHome() provided for INBOX.
Since SCREENS.HOME is a direct root-level screen (unlike INBOX which is nested inside REPORTS_SPLIT_NAVIGATOR), a single goBack(ROUTES.HOME) call is sufficient — no need for a new function or the double-call pattern that goBackToHome() uses.
…BackToHome Co-authored-by: truph01 <truph01@users.noreply.github.com>
|
Merged |
|
@carlosmiceli Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
I'd recommend against creating a Why
|
@MelvinBot I tested the current PR and yes, pressing browser/native back then returns to NotFound page again. To fix it, we can:
|
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 <truph01@users.noreply.github.com>
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-03-18.at.17.56.20.movAndroid: mWeb ChromeScreen.Recording.2026-03-18.at.17.57.41.moviOS: HybridAppScreen.Recording.2026-03-18.at.17.59.50.moviOS: mWeb SafariScreen.Recording.2026-03-18.at.17.54.53.movMacOS: Chrome / SafariScreen.Recording.2026-03-18.at.17.53.14.mov |
|
@MelvinBot We are making the navigation change in Others such as: we should leave it as it is. Give me your solution first before implementing! |
|
Great point! The current change applies Proposed SolutionKey insight: 1. Revert
|
|
@MelvinBot What about adding: then: |
|
Good question! Here's the trade-off between the two approaches: Your suggestion — add
Current PR approach —
That said, you're the assignee — if you'd prefer the |
|
@MelvinBot Let's implement useRoute() approach, and
right? |
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 <truph01@users.noreply.github.com>
|
Yes, exactly right! The conditional I've pushed the implementation with:
|
Rename isNotFoundScreen to isOnGenericErrorScreen to comply with the rulesdir/no-negated-variables ESLint rule. Co-authored-by: truph01 <truph01@users.noreply.github.com>
|
Fixed the failing ESLint check: renamed |
trjExpensify
left a comment
There was a problem hiding this comment.
Makes sense with a page in the product now called.. Home
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
🚧 @carlosmiceli has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.3.41-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.41-4 🚀
|
Explanation of Change
The "Go back to home page" link on the NotFoundPage was navigating to the Inbox (chat list with a report open) instead of the actual Home dashboard. This happened because
FullPageNotFoundViewdefaultsonLinkPresstoNavigation.goBackToHome(), which callsgoBack(ROUTES.INBOX).Now that HOME and INBOX are separate tabs, this override passes
onLinkPress={() => Navigation.navigate(ROUTES.HOME)}inNotFoundPageso the link correctly navigates to the Home dashboard. This is scoped toNotFoundPageto avoid affecting other callers ofgoBackToHome()that may intentionally navigate to the Inbox.Fixed Issues
$ #85222
PROPOSAL: #85222 (comment)
Tests
https://dev.new.expensify.com:8082/anything)/home, page shows "Home" heading with Time sensitive, For you, Discover sections) — NOT the Inbox with a chat openOffline tests
N/A — this change only affects navigation routing, which doesn't involve network requests.
QA Steps
https://staging.new.expensify.com/anything)PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A — navigation-only change, no UI modifications
Android: mWeb Chrome
N/A — navigation-only change, no UI modifications
iOS: Native
N/A — navigation-only change, no UI modifications
iOS: mWeb Safari
N/A — navigation-only change, no UI modifications
MacOS: Chrome / Safari
Tested on web dev environment: navigating to
/anythingshows 404 page, clicking "Go back to home page" now navigates to/home(Home dashboard with Time sensitive, For you, Discover sections) instead of the Inbox with a chat open.