refactor: cleanup duplicate create expense navigation logic#71820
Conversation
8cdebe9 to
7176b4f
Compare
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
…se-navigation-logic
It resolves lint warnings
…se-navigation-logic
It resolves lint issues and make sure that the extracted duplicate logic matches the code on main branch
75484a0 to
cf97278
Compare
|
@hungvu193 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] |
|
Please complete the author check + fix the spell check first. I'll be looking at the failing tests. |
|
The tests started failing after this commit. The Since I migrated the complete So, I didn't change the functionality of any existing function. I just created new ones, and one of them uses the I was expecting that removing the duplicate logic from those files would break some tests. But, the no. of failing tests are like something reusable function has changed. |
Sure, should I also prepare screen recordings for the checklist? If yes, then what exactly should be tested in the screencasts? |
Yes. Since you changed the IOU logic, make sure the IOU and other money request related flows work as expected. |
|
Alright, so you moved the function that used Let's do it. First of all you need to add mock function for App/tests/unit/useSearchHighlightAndScrollTest.ts Lines 19 to 24 in ef42b48 After that, please write unit test for the functions that you've added inside Here's the plan:
|
|
Thank you so much @hungvu193 :) |
|
Sounds like a plan 😉 |
…se-navigation-logic
|
That's great, in my testing the Android app also worked as expected 😀 |
|
Regression is completed |
|
Nice! |
|
Can we merge this PR now, @neil-marcellini? |
|
Yes. We're good to merge |
|
Hi @neil-marcellini, some conflicts arose again. I'm fixing the conflicts and will retest on my end after merging main. Please consider merging this PR after that. Thank you :) |
|
The iOS build task is failing on main. Should I wait or merge main right now? |
…se-navigation-logic
…se-navigation-logic
|
Little bump @neil-marcellini |
|
Everything works great now. I guess something was off in the backend last night. |
|
The lint check fails on main as well :( |
Linting is on main, it's not related to this PR. |
neil-marcellini
left a comment
There was a problem hiding this comment.
Good to go! Sorry for the delay, I was out yesterday.
|
@neil-marcellini looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
The failing test is on main |
|
Yeah, the failing ESLint check is on main. |
|
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.3.5-0 🚀
|
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.3.5-7 🚀
|


Explanation of Change
This PR extracts the duplicated logic from
IOURequestStepDistance,IOURequestStepDistanceMap,IOURequestStepDistanceManual,IOURequestStepScan/index.tsx,IOURequestStepScan/index.native.tsx, andIOURequestStepAmountfiles and creates reusable functions in theactions/IOU/MoneyRequest.tsfile.IOURequestStepScan/index.tsxandIOURequestStepScan/index.native.tsxfiles is extracted into thehandleMoneyRequestStepScanParticipantsfunction.IOURequestStepDistance,IOURequestStepDistanceMap, andIOURequestStepDistanceManualfiles is extracted into thehandleMoneyRequestStepDistanceNavigationfunction.navigateToConfirmationfunction from all the mentioned files is moved into theIOUUtils.tsfile.Fixed Issues
$ #69179
PROPOSAL: $ #69179 (comment)
Tests
Since this PR made changes in the Create Expense navigation logic, we should test these flows:
The above flows must be tested from:
+button)Mainly, we would test if the user is correctly navigated to the Confirmation Page or the Participants Page, if the user doesn't have a workspace created.
I believe everyone is familiar with the steps of each of the expense flows as mentioned above. That's why I'm not including steps, as nothing unique is implemented in this PR that may change the flow behavior. However, if any of the flow behaves differently from the main, then it must be a regression.
Note: This doesn't apply if the PR is outdated or not synced with the main branch.
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 stepssectioncanBeMissingparam foruseOnyxtoggleReportand 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_Native.mov
Android: mWeb Chrome
Android_Chrome.mov
iOS: Native
iOS_Native.mov
iOS: mWeb Safari
iOS_Safari.mov
MacOS: Chrome / Safari
Mac_Safari.1.mov