Repository navigation
Refactor MoneyRequestView component to eliminate redundant checks - #70994
Conversation
|
@linhvovan29546 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] |
| const actualParentReport = isFromMergeTransaction ? getReportOrDraftReport(getReportIDForExpense(updatedTransaction)) : parentReport; | ||
| const shouldShowReport = !!parentReportID || !!actualParentReport; | ||
|
|
||
| if (!report || !transaction) { |
There was a problem hiding this comment.
I’m unable to reproduce the issue where the report or transaction is empty, even after following the steps in the description.
I also have a question: the old condition checked whether the reportID or transactionID was empty, but the new changes check if the entire report or transaction object. I think these are not equivalent. as I remember reportID or transactionID can sometimes be '' or 0.
There was a problem hiding this comment.
I’m unable to reproduce the issue where the report or transaction is empty, even after following the steps in the description.
@linhvovan29546 and it's expected. The test steps also say it shouldn't be empty!
Let me update the condition!
There was a problem hiding this comment.
When empty, a separator line appears on the screen

I’m unable to reproduce the issue where the report or transaction is empty, even after following the steps in the description.
Okay, I can reproduce the empty when opening the page for the first time. If we clear the cache and then access the page via its URL.
There was a problem hiding this comment.
@linhvovan29546 It works as expected on my end:
Monosnap.screencast.2025-09-24.10-45-58.mp4
Could you please provide more detailed steps (maybe I did something wrong)?
Also, can you please try to do the same with the same page on main and let me know what are the results
There was a problem hiding this comment.
Ah, sorry—the image above is hardcoded, so it is incorrect. You can try following the steps in the video to reproduce the issue.
I was able to reproduce in the personal space, I'm not sure if this is expected. On the main branch, we still display the MoneyRequestView even when the value is empty.
Screen.Recording.2025-09-24.at.16.04.32.mov
There was a problem hiding this comment.
Yep, I was able to reproduce it!
I've updated the logic to show the loading instead, cause on main it shows the expense with no details for a second, which isn't great as well. @linhvovan29546 Let me know what you think!
|
What did it look like before? |
|
Can you show a recording of what it was before? I don't have strong feelings with this new skeleton view though, I guess it is consistent with other chat views in the app. Any additional thoughts @mountiny? Asking you since you've worked on these things before I think. |
|
Yeah same I think this is ok to show it this way with the skeleton |
You can see it at 0:11 Screen.Recording.2025-09-25.at.21.09.21.mov |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-09-26.at.19.19.11.movAndroid: mWeb ChromeScreen.Recording.2025-09-26.at.19.26.56.moviOS: HybridAppScreen.Recording.2025-09-26.at.18.57.47.moviOS: mWeb SafariScreen.Recording.2025-09-26.at.19.07.09.movMacOS: Chrome / SafariScreen.Recording.2025-09-26.at.18.39.31.movMacOS: DesktopScreen.Recording.2025-09-26.at.19.50.20.mov |
|
@VickyStash Could you please merge the Screen.Recording.2025-09-26.at.18.14.40.mov |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@VickyStash This worked for me. Could you please help add test section for |
Sure, just updated the section, let me know if anything else is needed! |
linhvovan29546
left a comment
There was a problem hiding this comment.
The PR worked for me. I’m not sure if we should add UI test for this change as well.
|
UI tests would be great, but it's NAB. |
|
spellcheck is unrelated, ignoring for now |
|
@roryabraham 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. |
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 9.2.19-0 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.2.19-3 🚀
|
| const actualParentReport = isFromMergeTransaction ? getReportOrDraftReport(getReportIDForExpense(updatedTransaction)) : parentReport; | ||
| const shouldShowReport = !!parentReportID || !!actualParentReport; | ||
|
|
||
| if (!report?.reportID || !transaction?.transactionID) { |
There was a problem hiding this comment.
Coming from #79072. transaction can be undefined for a self-DM expense opened whilst offline. So this condition would lead to displaying an infinite loader rather than displaying the cached data.


Explanation of Change
Refactor
MoneyRequestViewcomponent to eliminate redundant checksFixed Issues
$ #68829
PROPOSAL: N/A
Tests
Additional steps for WEB platform:
Offline tests
Same, as in the Tests section
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same, as in the Tests section
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))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.mp4
Android: mWeb Chrome
android_web.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios_web.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4