Repository navigation
Restore last visited page on cold start for public domain accounts - #103818
Conversation
Co-authored-by: huult <huult@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 ready for review |
|
🤖 This PR is now marked as ready for review. The Tests, Offline tests, and QA Steps sections still contain the TODO placeholders. The Screenshots/Videos sections for each platform are also empty. Please fill these in before review. The cold-start restore (kill and reopen the app while the Distance editor is open) still needs a manual test on Android and iOS. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-10-13.at.10.19.49.movAndroid: mWeb ChromeScreen.Recording.2026-10-13.at.09.48.21.moviOS: HybridAppScreen.Recording.2026-10-13.at.10.41.31.moviOS: mWeb SafariScreen.Recording.2026-10-13.at.10.24.08.movMacOS: Chrome / SafariScreen.Recording.2026-10-13.at.09.21.07.mov |
|
@MelvinBot please check off all the boxes in the checklist I verified here: #103818 (comment). Please also update the QA steps to the following: 1. Open the hybrid app.
2. As a Workspace member, open Workspace chat.
3. Submit a distance expense.
4. Open the transaction thread for the created expense.
5. Click **Distance** to open the distance editor RHP.
6. Add another waypoint.
7. Refresh the page while the distance editor RHP is open. On Android and iOS, close and reopen the app instead.
8. Verify that the waypoint list reverts to its original state and the unsaved waypoint added in step 6 is no longer present. |
|
Done. I updated the PR description:
Two parts of the description are still unfinished. Tell me if you want me to fill them in:
|
|
The TypeScript check failure is unrelated to this PR. |
|
@MelvinBot could you sync with main? |
…itedPathForPublicDomain Co-authored-by: huult <huult@users.noreply.github.com>
trjExpensify
left a comment
There was a problem hiding this comment.
Thanks for cleaning this up! 👍
neil-marcellini
left a comment
There was a problem hiding this comment.
Good to go. I updated the PR description for you to clean up a few things. In the future pls try to have Melvin do that for you. If it doesn't work let me know.
|
🚧 neil-marcellini 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! 🧪🧪
|
|
✋ 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 staging by https://github.com/neil-marcellini in version: 9.5.10-0 🚀
|
|
No help site update is needed. This bug fix makes the app reopen the last visited page on a cold start for public-domain accounts, which users already expect, and no help article describes this behavior. |
|
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.5.12-0 🚀
|
|
No help site update is needed. This bug fix makes the app reopen the last visited page on a cold start for public-domain accounts, which users already expect, and no help article describes this behavior. The PR's changes are the same as when I first reviewed it. |
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.5.12-1 🚀
Bundle Size Analysis (Sentry): |



Explanation of Change
On a native cold start there is no URL, so
NavigationRootreopens the last screen by restoringlastVisitedPath. An early return skipped that restore wheneveraccount.isFromPublicDomainwas true, so users with gmail.com, yahoo.com, and similar emails landed on the default tab instead of the page they had open (for example, the distance editor).That check was added in #45327 to stop public-domain users from skipping onboarding. The onboarding redirect now lives in
OnboardingGuard, which does not depend on the email domain, so the check only blocked the restore.This PR:
!account || account.isFromPublicDomainearly return and the now-unusedACCOUNTsubscription inNavigationRoot. The existingauthenticated, transition-URL, and deep-link checks still guard the restore.tests/unit/NavigationRootInitialStateTest.tsx. It checks that a public-domain account restoreslastVisitedPathon a cold start with no initial URL, and that a signed-out user does not.Once the distance editor is restored, the existing backup logic reverts the unsaved waypoint, so the distance step needs no change.
Note: on web, loading the bare root URL (
/) now also restores the last visited path for public-domain accounts. This matches what already happens for private-domain accounts.AI tests run
npm test -- tests/unit/NavigationRootInitialStateTest.tsx: passes. The public-domain test fails without the fix.npm run lint-changed: passes.npm run spell-changed: passes.npm run react-compiler-compliance-check check src/libs/Navigation/NavigationRoot.tsx: passes.npm run typecheck: the only errors are intests/actions/IOUTest/SplitTest.ts(missingreportDrafts). That file is not touched by this PR, so the errors are pre-existing.Fixed Issues
$ #103041
PROPOSAL: #103041 (comment)
Tests
Same as QA steps
Offline tests
N/A
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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