Fix: Normalize /Home URL to root in linking config to prevent NOT_FOUND on HybridApp - #92035
Conversation
…ND on HybridApp cold start Co-authored-by: truph01 <truph01@users.noreply.github.com>
|
@MelvinBot Could you give me End-to-End Flow from: "Try New Expensify" → Not Found Screen before and after the fix |
End-to-End Flow: "Try New Expensify" → Not FoundBefore the fix (broken)
After the fix1-4. Same as above — NewDot still receives Diff summaryOnly |
|
@MelvinBot I test your code change but it doesn't work |
|
Thanks for testing, Could you share:
Suspected gap with the current wrapperThe wrap rewrites
Candidate fix worth trying: rewrite to the lowercase 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 Once you confirm platform + observed screen, I can verify the candidate fix above and update the PR. |
|
@MelvinBot FYI, I try to normalize the path in |
Co-authored-by: truph01 <truph01@users.noreply.github.com>
|
Good call — that's the cleaner home for it. Moving the check into Pushed in 3315bb7:
Note: the leading-slash normalization at line 408 runs first, so the bare |
| // 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. |
There was a problem hiding this comment.
@MelvinBot Write a more general comment, not just in transition from OD to ND
There was a problem hiding this comment.
@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
End-to-End Flow:
|
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp600721518-b344efab-d08b-414d-8464-1f1ffe69d459.mp4Android: mWeb ChromeiOS: HybridAppScreen.Recording.2026-05-29.at.12.16.10.moviOS: mWeb SafariMacOS: Chrome / Safari |
Co-authored-by: truph01 <truph01@users.noreply.github.com>
|
Done in
All 10 tests in the file pass locally, plus adjacent navigation suites ( |
|
|
@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}`) { |
There was a problem hiding this comment.
❌ 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.
There was a problem hiding this comment.
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.
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ 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". |
|
🚧 @dylanexpensify has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
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}`) { |
There was a problem hiding this comment.
❌ 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.
|
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! |
|
🚧 @roryabraham 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/roryabraham in version: 9.3.97-0 🚀
Bundle Size Analysis (Sentry): |
|
🤖 Help site review: no changes required. This PR is an internal navigation/routing bug fix. It normalizes the 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 @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. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.3.97-1 🚀
|
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 theLinking.getInitialURL()override atsrc/setup/hybridApp/index.native.ts:9. NewDot has no linking-config entry for/Home:SCREENS.HOME = 'Home'(capital)ROUTES.HOME = 'home'(lowercase)PublicScreens.tsxregisters<RootStack.Screen name={SCREENS.HOME}>without apathmapping, so React Navigation derives a literal/HomeURL from the screen nameTAB_NAVIGATORmaps[SCREENS.HOME]: { path: ROUTES.HOME }→/homeReact Navigation's path matcher is case-sensitive, so
/Homedoes not match/homeand falls through the'*'wildcard atlinkingConfig/config.ts:36→SCREENS.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/Hometo''insideopenReportFromDeepLink), but that guard does not influenceNavigationContainer's cold-start state derivation. For public-domain (gmail) users,NavigationRoot.tsxreturnsundefinedearly, leaving React Navigation to calllinking.getStateFromPath('/Home')directly — which hits the NOT_FOUND wildcard.Fix: Wrap
getStateFromPathinsrc/libs/Navigation/linkingConfig/index.tsto normalize/Home(orHome) to''before delegating togetAdaptedStateFromPath. This mirrors the existingLink.tsguard 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
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari