Repository navigation
Discard changes confirmation closes the whole RHP - #106972
Conversation
Clicking outside the RHP sends a back with no target from the RHP's root-level route, which the root navigator handles by closing the RHP. When a discard prompt sends it again after Discard, react-navigation hands it to the innermost navigator instead, which only closes the top screen. The helper targets the root so the replay closes the whole RHP, and leaves other actions unchanged.
After the user picks Discard, the web discard prompt sends the blocked navigation again through getNavigationActionForReplay, so a click outside the RHP closes the whole RHP instead of only the guarded screen on top.
The native discard prompt sends the blocked navigation again through getNavigationActionForReplay, both after Discard and when it lets the navigation through without asking, so a click outside the RHP closes the whole RHP instead of only the guarded screen on top.
…eal navigators It renders a tab navigator, the RHP and the MoneyRequest stack with real navigators, so tests can open steps, click outside the RHP and read where the user ends up. Each step renders the component a test passes in.
…he whole RHP Runs the web and native discard prompts on a step stacked in the RHP. Clicking outside or pressing Esc and picking Discard closes the whole RHP, Cancel keeps everything open, and going back from the step and picking Discard only leaves that step.
…TestNavigator useNavigation returns a navigation whose getState can be undefined, which isn't a NavigationProp, so typecheck failed. The harness only calls goBack on it, so the type now only asks for that. The step name type was exported but never imported, which knip flagged.
…tNavigator ReturnType of useNavigation resolves its generic to unknown, so picking goBack from it failed typecheck. The RHP navigation is now typed as the goBack of NavigationProp<ParamListBase>, which the value useNavigation returns satisfies.
Only the create expense flow should close as a whole. Other pages, like the agent avatar page, keep going back to the previous page after a click outside and Discard, as on main.
Same as on web: other pages keep going back to the previous page after a click outside and Discard.
…ses a page outside the create expense flow
…eating an expense
Codex Review Summary: ✅ CompletedThis 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. |
|
@FitseTLT can you review this today, please? |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp2026-11-18.22-28-07.mp4Android: mWeb Chrome2026-11-19.15-48-07.mp4iOS: HybridAppiOS: mWeb Safari2026-11-19.15-53-38.mp4MacOS: Chrome / Safari2026-11-19.15-38-22.mp4 |
|
@FitseTLT you happy? |
mountiny
left a comment
There was a problem hiding this comment.
Thanks for moving this ahead
|
✋ 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.5.53-0 🚀
|
|
No help site update needed — this PR fixes dismissal of the expense-creation panel to behave as expected, without adding a new workflow or making existing article instructions incorrect. |
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.5.53-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Problem
Discard only closes the focused screen instead of closing the whole RHP. For example, on the Category step from Confirmation, clicking outside and then Discard takes the user back to Confirmation.
Solution
Add a
shouldCloseRHPOnDiscardoption touseDiscardChangesConfirmation. When it's set and the user picks Discard after a click outside, the blocked navigation is sent to the root navigator, so the whole RHP closes. Every other navigation (header back, browser back, Android back, iOS swipe) is sent again unchanged.Set it on the create expense steps that have the modal, only while creating an expense. This covers:
Fixed Issues
$ #104579
PROPOSAL:
Tests
Test case 1: Discard after clicking outside closes the whole RHP(wide-layout only)
Test case 2: Discard after going back only closes the top step
Test case 3: Pages outside the create expense flow work as before
Offline tests
NA
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@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
Screen.Recording.2026-11-16.at.15.13.59.mov
iOS: mWeb Safari
Screen.Recording.2026-11-16.at.15.11.48.mov
MacOS: Chrome / Safari
Test case 1:
Screen.Recording.2026-11-16.at.15.06.54.mov
Test case 2:
Screen.Recording.2026-11-16.at.15.07.35.mov
Test case 3:
Screen.Recording.2026-11-16.at.15.07.56.mov