Logged-out sign-in page URL shows /Home instead of root #94433
Conversation
PublicScreens registered the SignInPage under the top-level SCREENS.HOME, which has no root-level path mapping (it's only mapped as "home" nested in TAB_NAVIGATOR), so React Navigation derived "/Home" from the screen name. Logging out from the Home tab also surfaced "/home" because the post-logout reset carried over the nested tab focus. Register the SignInPage under NAVIGATORS.TAB_NAVIGATOR instead, mirroring the authenticated top-level navigator (as it used to be registered under REPORTS_SPLIT_NAVIGATOR). TAB_NAVIGATOR has no path of its own, so the unauthenticated URL stays at "/". Update the post-logout and validate-login resets to target TAB_NAVIGATOR and drop any carried-over nested tab state so logout always lands on "/".
- Add PublicSignInPageRootUrlTest: mounts the real PublicScreens navigator and asserts the root route renders SignInPage under TAB_NAVIGATOR and resolves to "/" (verified to fail if reverted to SCREENS.HOME). - Rename getPathFromStatePublicHomeTest -> publicSignInPageUrlResolutionTest; drive the real linking config round-trip (getAdaptedStateFromPath -> getPathFromState), cover the legacy /Home -> / redirect, and fix the mislabeled authenticated-root case.
- Trim comments to behavior-only (drop change/history narration) across PublicScreens, getAdaptedStateFromPath, getStateToResetAfterLogout, types, and the ValidateLoginPage 2FA reset. - Consolidate navigation tests into one PublicScreens render guard (renders SignInPage under TAB_NAVIGATOR at '/', plus the legacy /Home -> / redirect); remove the redundant getPathFromState resolution file. - Make the test's jest.mock factory robust (mock-prefixed hoisted function declaration) instead of relying on module-load ordering.
# Conflicts: # src/libs/Navigation/NavigationRoot.tsx
restoreTabNavigatorRoutes reattaches the prior session's TAB_NAVIGATOR subtree to the public sign-in route (which now shares that name), so the logged-out reset failed to drop a previous deep-linked report. Evict the in-memory preserved navigator states on logout so the next session starts clean.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@nyomanjyotisa 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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e15cfeaa6a
ℹ️ 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".
| ...rootState, | ||
| index: 0, | ||
| routes: [{...lastRoute, params: shouldClearParams ? undefined : lastRoute.params}], | ||
| routes: [{...lastRoute, params: shouldClearParams ? undefined : lastRoute.params, state: shouldClearNestedState ? undefined : lastRoute.state}], |
There was a problem hiding this comment.
Clear TAB_NAVIGATOR params during logout reset
Please also clear params when lastRoute.name === NAVIGATORS.TAB_NAVIGATOR. Some TAB_NAVIGATOR routes carry their child tab in params rather than only in state (for example, getRehydratedTabNavigatorStateAfterPush() stores the full tab subtree in params.state), but this reset now drops state while preserving those params. Since PublicScreens and AuthScreens share the TAB_NAVIGATOR route name, logging out from such a route can leave the previous session's tab subtree attached to the public sign-in route and let the next login hydrate back to a stale tab/path instead of starting cleanly at /.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I think this comment is valid. We can get a dirty URL from leftover params after logout
Steps to reproduce:
- Log in to the Expensify App
- Navigate around in-app a few times (jump across tabs into a nested page)
- Log out and observe the URL
MacOS-Chrome.mov
What do you think? @sumo-slonik
There was a problem hiding this comment.
Good catch @nyomanjyotisa, thanks for digging into this and sharing the clear repro 🙏 Taking a closer look now and will follow up shortly.
There was a problem hiding this comment.
Confirmed and already fixed: the carried-over tab subtree also lives in params.state (not just state), so the post-logout reset now clears params for TAB_NAVIGATOR as well — the public sign-in route lands cleanly on /.
There was a problem hiding this comment.
Screen.Recording.2026-06-30.at.15.30.40.mov
The tab subtree carried over from an authenticated session lives in both route.state and params.state (getRehydratedTabNavigatorStateAfterPush writes it under params). Clearing only state left the params behind, which surfaced as a dirty post-logout URL and could rehydrate a stale tab on the next login. Clear params too so the public sign-in route resets to a clean "/".
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeAndroid-mWeb.Chrome.mp4iOS: HybridAppiOS: mWeb SafariiOS-mWeb.Safari.mp4MacOS: Chrome / SafariMacOS-Chrome.mov |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 mountiny 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/mountiny in version: 9.4.26-0 🚀
|
|
🤖 I reviewed the changes in this PR against the help site files under This PR moves the logged-out sign-in page URL on web from
I opened a draft PR updating that link to Draft PR: #95086 No other help site changes are needed — this was a navigation/URL-resolution fix with no other user-facing documented behavior. @sumo-slonik, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR |
|
@sumo-slonik @nyomanjyotisa Are we expecting Recording.993.mp4 |
Yes, that's working as designed. |
|
🚀 Deployed to production by https://github.com/grgia in version: 9.4.27-2 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
The logged-out sign-in page showed
/Homeon web becausePublicScreensregisteredSignInPageasSCREENS.HOME. Registering it underNAVIGATORS.TAB_NAVIGATOR(which has no path of its own) keeps the URL at the root/, and the related logout / 2FA reset paths are updated to match (with a/Home→/redirect kept for legacy cached paths).Fixed Issues
$ #94450
PROPOSAL:
Tests
/(NOT/Home)./Homewhile logged out and verify it redirects to/././(NOT/home).Offline tests
N/A — this change only affects unauthenticated navigation/URL resolution and has no offline-specific behavior.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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.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