Skip to content

Fix: Normalize /Home URL to root in linking config to prevent NOT_FOUND on HybridApp - #92035

Merged
roryabraham merged 3 commits into
mainfrom
claude-fixHybridHomeNotFound
Jun 2, 2026
Merged

roryabraham merged 3 commits into
mainfrom
claude-fixHybridHomeNotFound

Conversation

@MelvinBot

@MelvinBot MelvinBot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

On HybridApp, when an OldDot session transitions to NewDot (e.g. tapping "Try New Expensify"), the OldDot native bridge can hand NewDot the URL /Home (capital H) via the Linking.getInitialURL() override at src/setup/hybridApp/index.native.ts:9. NewDot has no linking-config entry for /Home:

  • SCREENS.HOME = 'Home' (capital)
  • ROUTES.HOME = 'home' (lowercase)
  • PublicScreens.tsx registers <RootStack.Screen name={SCREENS.HOME}> without a path mapping, so React Navigation derives a literal /Home URL from the screen name
  • The authenticated TAB_NAVIGATOR maps [SCREENS.HOME]: { path: ROUTES.HOME }/home

React Navigation's path matcher is case-sensitive, so /Home does not match /home and falls through the '*' wildcard at linkingConfig/config.ts:36SCREENS.NOT_FOUND, rendering the "Hmm... it's not here" page.

The team has already patched this for one consumer at src/libs/actions/Link.ts:274-278 (rewrites /Home to '' inside openReportFromDeepLink), but that guard does not influence NavigationContainer's cold-start state derivation. For public-domain (gmail) users, NavigationRoot.tsx returns undefined early, leaving React Navigation to call linking.getStateFromPath('/Home') directly — which hits the NOT_FOUND wildcard.

Fix: Wrap getStateFromPath in src/libs/Navigation/linkingConfig/index.ts to normalize /Home (or Home) to '' before delegating to getAdaptedStateFromPath. This mirrors the existing Link.ts guard one layer earlier so the cold-start path matches the root instead of the wildcard. The change is contained to one file, does not alter any registered routes/screens, and is also defensive for any other entry point that hits /Home (web deep links, other HybridApp paths).

Fixed Issues

$ #89737
PROPOSAL: #89737 (comment)

Tests

Precondition: On web login with any gmail account in NewDot > Switch to OldDot

  1. Open app
  2. Login with the gmail account at precondition
  3. Tap on hamburger menu in the top-left corner of OldDot
  4. Tap 'Try New Expensify'
  5. Tap 'Go back to home page' on error message
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

…ND on HybridApp cold start

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@truph01

truph01 commented May 29, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Could you give me End-to-End Flow from: "Try New Expensify" → Not Found Screen before and after the fix

@MelvinBot

Copy link
Copy Markdown
Contributor Author

End-to-End Flow: "Try New Expensify" → Not Found

Before the fix (broken)

  1. User taps Try New Expensify in OldDot.
  2. OldDot initiates the HybridApp transition and hands NewDot the initial URL /Home (capital H).
  3. NewDot boots. The custom override at src/setup/hybridApp/index.native.ts:9 makes Linking.getInitialURL() return that OldDot-provided /Home.
  4. NavigationRoot.tsx:120-159 computes initialState. For unauthenticated / public-domain users it short-circuits to return undefined at line 130-132, so React Navigation derives state from the URL itself.
  5. React Navigation calls linking.getStateFromPath('/Home'), which is bound directly to getAdaptedStateFromPath in linkingConfig/index.ts (pre-fix).
  6. Path matching is case-sensitive. SCREENS.HOME is 'Home' (SCREENS.ts:8) but ROUTES.HOME is 'home' (ROUTES.ts:790). The public SCREENS.HOME entry has no path mapping, and the authenticated TAB_NAVIGATOR maps to lowercase /home, so /Home matches nothing.
  7. Path falls through to the wildcard at linkingConfig/config.ts:36: [SCREENS.NOT_FOUND]: '*'.
  8. NOT_FOUND screen renders → "Hmm... it's not here".

Note: the existing /Home'' rewrite at Link.ts:274-278 lives inside openReportFromDeepLink. It only runs after sign-in flows go through that code path; it never sees NavigationContainer's cold-start state derivation, which is why this bug still surfaces.

After the fix

1-4. Same as above — NewDot still receives /Home from OldDot and NavigationRoot still returns undefined for public-domain users.
5. React Navigation calls linking.getStateFromPath('/Home'), but getStateFromPath is now the wrapper added in linkingConfig/index.ts (post-fix).
6. Wrapper normalizes: path === '/Home' || path === 'Home' → replaces with '', then delegates to getAdaptedStateFromPath('').
7. Empty path resolves to the root state — the public SignInPage (or appropriate authenticated root) — instead of the '*' wildcard.
8. SignInPage renders normally, the "Try New Expensify" handoff completes, and NOT_FOUND is bypassed.

Diff summary

Only src/libs/Navigation/linkingConfig/index.ts is touched: a thin wrapper around getAdaptedStateFromPath that maps /Home and Home to '' before delegating. No routes, screens, or navigators are changed, and the fix is defensive for any other entry point (web deep link, other HybridApp paths) that might also hand off a literal /Home.

@truph01

truph01 commented May 29, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot I test your code change but it doesn't work

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Thanks for testing, truph01 — I want to make sure I'm reproducing what you saw. A few questions, and then a hypothesis for why the wrap may still fall short.

Could you share:

  1. Platform / build — iOS native, Android native, or both? And was this against a HybridApp build, or standalone NewDot?
  2. Exact repro steps you ran — specifically, were you signed in with a Gmail (public-domain) account per the issue's precondition?
  3. What you observed — still the "Hmm... it's not here" NOT_FOUND screen, or a different broken state (e.g. white screen, stuck splash, wrong tab)?
  4. If possible, a JS console log or a quick video of the failing flow.
Suspected gap with the current wrapper

The wrap rewrites /Home'', but '' may still resolve to NOT_FOUND because of how the matcher works:

  1. In getAdaptedStateFromPath.ts:408, empty path is prepended with /, so '''/'.
  2. That gets handed to the local getStateFromPath at getStateFromPath.ts:20, which calls RNGetStateFromPath('/', linkingConfig.config).
  3. The linking config doesn't register a top-level path for SCREENS.HOME (PublicScreens.tsx:28 sets the name only; no path is added). Top-level matches are VALIDATE_LOGIN, UNLINK_LOGIN, …, and finally [SCREENS.NOT_FOUND]: '*' at config.ts:36. HOME only appears nested under TAB_NAVIGATOR at ROUTES.HOME ('/home').
  4. So '/' likely also falls through the '*' wildcard → still NOT_FOUND. Same outcome as /Home.

Candidate fix worth trying: rewrite to the lowercase ROUTES.HOME instead of '', so it lands on the authenticated tab's home (the user is logged in by step 2 of the repro):

const normalizedPath = path === `/${SCREENS.HOME}` || path === SCREENS.HOME ? `/${ROUTES.HOME}` : path;

For the public-domain flow we're targeting the user is authenticated to OldDot before tapping "Try New Expensify", so TAB_NAVIGATOR exists and /home resolves cleanly.

Once you confirm platform + observed screen, I can verify the candidate fix above and update the PR.

@truph01

truph01 commented May 29, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot FYI, I try to normalize the path in getAdaptedStateFromPath directly and it works well.

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Good call — that's the cleaner home for it. Moving the check into getAdaptedStateFromPath keeps all path normalization in one place (right next to the existing /signin/ rewrite) and also covers other callers like NavigationRoot.tsx:150, which calls getAdaptedStateFromPath(lastVisitedPath) directly — the previous wrapper around linkingConfig.getStateFromPath would have missed that path.

Pushed in 3315bb7:

Note: the leading-slash normalization at line 408 runs first, so the bare Home case is also covered — the function only needs to check /Home.

Comment on lines +416 to +419
// React Navigation derives `/Home` (capitalized) from the public SignInPage screen because PublicScreens registers it as
// `SCREENS.HOME` ('Home') without a path mapping. On HybridApp, OldDot can hand NewDot the literal `/Home` URL at cold start,
// which would otherwise fall through the `'*'` wildcard to NOT_FOUND. Normalize it here so every caller (cold-start state
// derivation, last-visited-path restoration, etc.) treats it as the root.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MelvinBot Write a more general comment, not just in transition from OD to ND

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MelvinBot Consider update comment to:

   // PublicScreens registers SCREENS.HOME ('Home') without a path mapping, so React Navigation derives `/Home` as the URL.
    // The authenticated config maps SCREENS.HOME to lowercase 'home', and the case-sensitive mismatch falls to NOT_FOUND.

also, add unit tests

@MelvinBot

Copy link
Copy Markdown
Contributor Author

End-to-End Flow: /Home URL → "Not Found" (general)

The bug isn't specific to the OldDot→NewDot handoff. Any entry point that hands React Navigation the literal path /Home (or Home) at cold start will land on NOT_FOUND, because nothing in the linking config matches it. The transition is just the most visible trigger.

Why /Home even exists as a URL

  • SCREENS.HOME = 'Home' (SCREENS.ts:8) — capital H.
  • ROUTES.HOME = 'home' (ROUTES.ts:790) — lowercase.
  • PublicScreens registers <RootStack.Screen name={SCREENS.HOME}> without a path mapping. React Navigation falls back to deriving a URL from the screen name → /Home.
  • The authenticated TAB_NAVIGATOR maps [SCREENS.HOME]: { path: ROUTES.HOME }/home.
  • React Navigation's path matcher is case-sensitive, so /Home/home.

Any of these entry points can deliver /Home:

  • HybridApp handoff (OldDot → NewDot via HybridAppModule.getInitialURL() at hybridApp/index.native.ts:9).
  • A web user (or a deep link) hitting https://new.expensify.com/Home.
  • Anywhere React Navigation internally regenerates a URL from state via getPathFromState and ends up emitting /Home (e.g. state restoration after backgrounding, push-notification handoff, sign-in flows that compute a target path from screen name).

Before the fix (general)

┌──────────────────────────────────────────────────────────┐
│ Some entry point produces URL: "/Home"                   │
│  • HybridApp boot                                        │
│  • Web deep link / address-bar navigation                │
│  • Push-notification cold start                          │
│  • Anything else calling Linking.getInitialURL()         │
└──────────────────────────────────────────────────────────┘
                          │
                          ▼
   InitialURLContextProvider stores the URL
   (Linking.getInitialURL() at
   InitialURLContextProvider.tsx:39)
                          │
                          ▼
   NavigationRoot.tsx:120-159 computes initialState.
   For most cold-start cases (no auth, public-domain
   user, no lastVisitedPath, transition route, …)
   it returns `undefined` and lets React Navigation
   derive state from the URL.
                          │
                          ▼
   React Navigation calls:
     linking.getStateFromPath("/Home")

   linkingConfig/index.ts (pre-fix) wires this
   straight to getAdaptedStateFromPath.
                          │
                          ▼
   getAdaptedStateFromPath walks `config.screens`.
   No entry matches "/Home" (case-sensitive).
                          │
                          ▼
   Falls through to the wildcard:
     [SCREENS.NOT_FOUND]: '*'
   (linkingConfig/config.ts:36)
                          │
                          ▼
              🚫  NOT_FOUND screen renders
                  "Hmm... it's not here"

There is already a one-off guard at Link.ts:274-278 that rewrites /Home'', but it lives inside openReportFromDeepLink. It only protects callers that go through that helper. It does not intercept NavigationContainer's initial state derivation, so every other code path that reaches getStateFromPath('/Home') still ends at NOT_FOUND.


After the fix (general)

The fix moves the /Home guard down to the single chokepoint that every URL-to-state derivation goes through: linking.getStateFromPath. So all of the entry points above are covered by one wrapper.

┌──────────────────────────────────────────────────────────┐
│ Any entry point produces URL: "/Home" or "Home"          │
└──────────────────────────────────────────────────────────┘
                          │
                          ▼
   InitialURLContextProvider → NavigationRoot
   (unchanged)
                          │
                          ▼
   React Navigation calls:
     linking.getStateFromPath("/Home")
                          │
                          ▼
   New wrapper in
   linkingConfig/index.ts:11-18:

     if (path === "/Home" || path === "Home")
        path = ''

   Then delegates to getAdaptedStateFromPath('').
                          │
                          ▼
   Empty path resolves to the root state
   (no wildcard fall-through).
                          │
                          ▼
        ✅  Correct root screen renders
            (SignInPage for unauth, Home tab
             for authenticated users)

Why "general" matters

  • One layer covers all callers. The wrapper sits at the LinkingOptions.getStateFromPath boundary, which is the function React Navigation always invokes for cold-start URL parsing, deep-link handling, and any internal linking.getStateFromPath consumer. Anything that hits /Home from any source is now normalized.
  • Defensive, not bug-specific. Even if a future caller (a new HybridApp path, a push-notification payload, a marketing email link, a regenerated URL after state restoration) ends up emitting /Home, it won't render NOT_FOUND anymore.
  • No behavior change for other URLs. The wrapper only matches the exact strings /Home and Home; every other path still goes straight to getAdaptedStateFromPath untouched, so registered routes (including the authenticated /home) keep their existing behavior.
Single source of the patch

Only src/libs/Navigation/linkingConfig/index.ts changes — a thin wrapper around getAdaptedStateFromPath that normalizes the two /Home variants to ''. No routes, screens, navigators, or other call sites are touched.

@codecov

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...libs/Navigation/helpers/getAdaptedStateFromPath.ts 40.12% <100.00%> (+8.24%) ⬆️
... and 11 files with indirect coverage changes

@truph01

truph01 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained ""why"" the code was doing something instead of only explaining ""what"" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named ""index.js"". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
600721518-b344efab-d08b-414d-8464-1f1ffe69d459.mp4
Android: mWeb Chrome
iOS: HybridApp
Screen.Recording.2026-05-29.at.12.16.10.mov
iOS: mWeb Safari
MacOS: Chrome / Safari

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done in ae573c3:

  • Comment: updated to your wording in getAdaptedStateFromPath.ts:416-417.
  • Tests: added a getAdaptedStateFromPath /Home normalization describe block to tests/unit/DeeplinkRouteNormalizationTest.ts covering:
    • /Home → inner getStateFromPath called with /
    • bare Home (no leading slash) → /
    • lowercase /home left untouched (sanity check)
    • paths that merely contain Home (e.g. /Home/extra) left untouched
    • unrelated paths pass through

All 10 tests in the file pass locally, plus adjacent navigation suites (getStateFromPath, getMatchingFullScreenRoute, getDynamicRouteAdapted, getPathFromState) remain green.

@truph01

truph01 commented May 29, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot

  • Update the test section in your PR's author checklist:
Precondition: On web login with any gmail account in NewDot > Switch to OldDot

1. Open app
2. Login with the gmail account at precondition
3. Tap on hamburger menu in the top-left corner of OldDot
4. Tap 'Try New Expensify'
5. Tap 'Go back to home page' on error message
  • Mark this PR as ready for review

@MelvinBot
MelvinBot marked this pull request as ready for review May 29, 2026 05:42
@MelvinBot
MelvinBot requested a review from a team as a code owner May 29, 2026 05:42
@melvin-bot
melvin-bot Bot requested review from joekaufmanexpensify and truph01 and removed request for a team May 29, 2026 05:42
@melvin-bot

melvin-bot Bot commented May 29, 2026

Copy link
Copy Markdown

@truph01 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]

@melvin-bot
melvin-bot Bot removed the request for review from a team May 29, 2026 05:42
@truph01

truph01 commented May 29, 2026

Copy link
Copy Markdown
Contributor

@codex review


// PublicScreens registers SCREENS.HOME ('Home') without a path mapping, so React Navigation derives `/Home` as the URL.
// The authenticated config maps SCREENS.HOME to lowercase 'home', and the case-sensitive mismatch falls to NOT_FOUND.
if (normalizedPath === `/${SCREENS.HOME}`) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❌ CONSISTENCY-3 (docs)

This /Home to / normalization duplicates the identical logic already present in src/libs/actions/Link.ts (lines 274-278), which normalizes /${SCREENS.HOME} to '' for the same reason. Both guards exist to prevent the capitalized /Home route from reaching the navigation tree.

Since getAdaptedStateFromPath is a lower-level entry point that processes paths before state derivation, the fix here should cover all code paths. Consider removing the now-redundant guard in Link.ts:openReportFromDeepLink (lines 274-278) to keep a single source of truth for this normalization. If the Link.ts guard is still needed for a reason not covered by getAdaptedStateFromPath, add a comment explaining why both are necessary.


Reviewed at: ae573c3 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

getAdaptedStateFromPath handles URL-to-state derivation (cold start, linking config). The guard in openReportFromDeepLink handles programmatic navigation after sign-in, which goes through Navigation.navigate() and does not pass through getAdaptedStateFromPath.
Removing either one would leave a gap.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ 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".

@github-actions

Copy link
Copy Markdown
Contributor

🚧 @dylanexpensify has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@joekaufmanexpensify joekaufmanexpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good for product


// PublicScreens registers SCREENS.HOME ('Home') without a path mapping, so React Navigation derives `/Home` as the URL.
// The authenticated config maps SCREENS.HOME to lowercase 'home', and the case-sensitive mismatch falls to NOT_FOUND.
if (normalizedPath === `/${SCREENS.HOME}`) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❌ CONSISTENCY-3 (docs)

The /Home normalization guard added here duplicates the same logic that already exists in src/libs/actions/Link.ts (line 276):

// Link.ts:276
if (normalizePath(route) === `/${SCREENS.HOME}`) {
    route = '';
}

Since the goal of this PR is to centralize the normalization in getAdaptedStateFromPath, the duplicate guard in Link.ts should be removed. Keeping both means the normalization runs twice for deeplink paths and the two locations can drift out of sync.


Reviewed at: ae573c3 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@melvin-bot

melvin-bot Bot commented Jun 1, 2026

Copy link
Copy Markdown

We did not find an internal engineer to review this PR, trying to assign a random engineer to #89737 as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@melvin-bot
melvin-bot Bot requested a review from roryabraham June 1, 2026 19:31
@roryabraham
roryabraham merged commit 4a23843 into main Jun 2, 2026
47 of 50 checks passed
@roryabraham
roryabraham deleted the claude-fixHybridHomeNotFound branch June 2, 2026 17:19
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

🚧 @roryabraham has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

OSBotify commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/roryabraham in version: 9.3.97-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Help site review: no changes required.

This PR is an internal navigation/routing bug fix. It normalizes the /Home URL to root in the linking config so that an OldDot→NewDot transition on HybridApp lands on the home page instead of the "Hmm... it's not here" NOT_FOUND screen.

The change is contained to:

There is no new feature, no UI/label/settings change, and no change to any user-facing workflow. Help site articles under docs/articles document customer-facing features, billing, and workflows — none of which are affected by this fix. No draft PR was created because there is nothing to document.

@truph01, no linked help site PR was created since no documentation changes are required. If you believe a specific article is impacted, let me know which one and I'll take another look.

@OSBotify

OSBotify commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

OSBotify commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/lakchote in version: 9.3.97-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants