refactor: Split submitAmount into focused submit and navigation helpers#95392
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
# Conflicts: # src/libs/IOUAmountSubmission.ts
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ 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". |
# Conflicts: # src/libs/IOUAmountSubmission.ts
# Conflicts: # src/libs/IOUAmountSubmission.ts
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-07-09.at.17.42.05.mov |
|
Bug: After submitting the amount with global create, it navigates again to the amount screen. Screen.Recording.2026-07-09.at.16.15.16.mov |
I was able to reproduce this as well. It wasn't caused by this refactor though, it's a missing part from the previous PR. Fixed already. |
# Conflicts: # src/libs/IOUAmountSubmission.ts
|
✋ 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/Julesssss in version: 9.4.33-0 🚀
|
|
🤖 No help site changes required. I reviewed the changes in this PR against the help site files under Why: This is a pure internal refactor. The PR only touches Since no draft docs PR is warranted, none was created and no @OlimpiaZurek, please confirm you agree that no help site changes are required here. If you believe a specific article does need updating, let me know which behavior changed and I'll create the draft help site PR for review. |
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.4.33-8 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
This PR refactors
submitAmountinsrc/libs/IOUAmountSubmission.ts. It was an extremely large function (~365 lines, with a nested 240-linenavigateToNextPageclosure capturing ~30 variables) that mixed navigation with submission logic. It is now decomposed into focused, single-purpose functions:Submission logic (domain writes only, no route building):
submitAmount— thin dispatcher (~15 lines): derives shared context, then runs the create or edit flowbuildSubmitAmountContext— derives shared flags/amount once instead of per-branchsubmitCreateAmount→submitCreateWithReport/submitGlobalCreate— the create flowsubmitSkipConfirmationPayment/submitSkipConfirmationExpense— the skip-confirmation PAY/SEND and TRACK/REQUEST branchessubmitEditAmount— the edit flow, with early returns hoisted to the topNavigation (all route building and
Navigation.*calls, separated from the logic above:navigateToConfirmationAfterAssigningParticipantsnavigateToDefaultWorkspacenavigateToExistingParticipantConfirmationnavigateToParticipantPageDeferredFixed Issues
$ #92411
PROPOSAL:
Tests
Offline tests
QA Steps
Same as tests
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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