Repository navigation
Restore the pre-inserted tab route by key on cancel - #105857
Conversation
handleRemoveFullscreenUnderRHP wrote the saved tab route over the last TAB_NAVIGATOR found by name. When the RHP had opened another fullscreen tab since the pre-insert, that overwrote the newer tab, leaving two root routes with the same key and handing the top RHP a tab navigator state, which crashed in getStateForRouteNamesChange. The pre-insert keeps the original tab route key, so look the slot up by that key instead.
|
@QichenZhu 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] |
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. |
revertPreMountBufferIfRHPClosed and recoverFromPreMountBuffer had the same last-TAB_NAVIGATOR-by-name lookup as handleRemoveFullscreenUnderRHP, so a tab pushed after the pre-insert could be overwritten by the saved route. The two existing tab-restore tests now use the key the pre-insert keeps and assert on the captured route, since the mocked clear made them compare undefined with undefined.
dylanexpensify
left a comment
There was a problem hiding this comment.
product input not required
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen_recording_20261105_072055.webmAndroid: mWeb ChromeScreen_recording_20261105_072841.webmiOS: HybridAppSimulator.Screen.Recording.-.iPhone.17.-.2026-11-05.at.07.18.46.moviOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.17.-.2026-11-05.at.07.42.23.movMacOS: Chrome / SafariScreen.Recording.2026-11-05.at.7.46.48.AM.mov |
|
NAB: on mobile web, after tapping Add payment card, the background screen sometimes switches to Spend. Same on staging. Screen_recording_20261105_084750.webm |
yeah i think this is out of scope for this PR. |
|
@MelvinBot can you check if there is an issue for #105857 (comment) and create it if not? can you also analyze if this is a regression from some recent pr? |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
Found an existing open issue: Trial ended—User is not navigated to Subscription page after clicking Add payment card. It covers the same restricted-workspace button opening the card form over the wrong background. I haven’t created a duplicate. The exact intermittent mobile-web Spend switch is not independently confirmed as the same bug. ProposalWhat is the root cause of that problem?Likely a regression from Keep the page an RHP was opened from underneath it, merged October 27. That PR changed this button from a fixed Subscription destination to a dynamic route based on the active page after modal dismissal. Consequently, the card form no longer necessarily opens over Subscription. Code evidence and the Spend-specific uncertainty
What changes do you think we should make in order to solve the problem?For this restricted-workspace entry point, explicitly anchor the card form to Subscription, preserving the intended return navigation. Keep dynamic backgrounds for other entry points. Cover both Inbox and Spend starting contexts, including closing the form. What alternative solutions did you explore? (Optional)This is unlikely to originate in this PR: the original report reproduced it on staging before this PR merged. A separate transient pre-insert cleanup bug remains possible; distinguish that from the already-tracked wrong destination before opening another issue. Verification: The web check was blocked by a blank page. Attribution of the exact Spend symptom remains medium confidence, not runtime-proven. Next Steps for Contributor+ team: |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.5.33-0 🚀
|
|
No FullStory changes needed. This PR only fixes tab-route restoration to prevent a navigation crash and adds regression tests, without introducing new UI, screens, user-property values, or sensitive content. |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.5.33-1 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Cancelling a tab pre-inserted under the RHP wrote the saved tab route over the last TabNavigator by name, so when the RHP had opened another TabNavigator since, two root routes ended up with the same key and the top RHP crashed on a tab state. The restore now finds the saved route by its key and puts it back in its own slot.
Fixed Issues
$ #103777
PROPOSAL: #103777 (comment)
Tests
Precondition: the account has a restricted workspace (it shows "Add a payment card").
type:expenseand submit it.Offline tests
Same as Tests while offline. The change is a client-side navigation state update with no network calls, so the result is the same offline and online.
QA Steps
Same as tests.
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 theExpensify/designteam so 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.app.mp4
Android: mWeb Chrome
android.web.mp4
iOS: Native
ios.app.mp4
iOS: mWeb Safari
ios.web.mp4
MacOS: Chrome / Safari
web.mp4