decompose MoneyReportHeader secondary actions#88304
Conversation
|
@abzokhattab 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] |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e92c41b8e1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
820676c to
a233517
Compare
| ownerBillingGracePeriodEnd, | ||
| methodID: type === CONST.IOU.PAYMENT_TYPE.VBBA ? methodID : undefined, | ||
| onPaid: () => { | ||
| startAnimation(); |
There was a problem hiding this comment.
I think we might have discussed it before, but I see that the guard on animation was removed
Should we bring it back?
onPaid: () => {
if (isFromSelectionMode) { return; } // ← guard removed in new code
startAnimation();
},There was a problem hiding this comment.
this is the selection-mode path only, so isFromSelectionMode would always be true here
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-04-13.at.23.23.09.movAndroid: mWeb ChromeScreen.Recording.2026-04-13.at.23.29.37.moviOS: HybridAppScreen.Recording.2026-04-13.at.23.25.50.moviOS: mWeb SafariScreen.Recording.2026-04-13.at.23.28.05.movMacOS: Chrome / SafariScreen.Recording.2026-04-13.at.23.17.58.mov |
abzokhattab
left a comment
There was a problem hiding this comment.
Added a small comment but overall it looks good to me
|
🚧 @rlinoz 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! 🧪🧪
|
|
✋ 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/rlinoz in version: 9.3.61-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This is a purely internal refactor that decomposes |
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.3.61-4 🚀
|
Explanation of Change
MoneyReportHeader had grown to ~2448 lines, mixing rendering logic with business logic for hold menus, primary actions, expense actions, and selection mode. This PR extracts that logic into focused hooks and components:
useReportPrimaryAction— replaces the inline primary action derivation; removes animation knowledge fromgetReportPrimaryActionwhich now returns a plain valueuseExpenseActions— owns all secondary expense action callbacks (hold, unhold, etc.); receivesisReportInSearchas a prop instead of hardcodingfalseuseTransactionThreadReport— fetches the transaction thread report internally viauseOnyxinstead of requiring callers to pass it downActionsBar— renders sub-components directly; no longer accepts ReactNode props, eliminating the pattern that forced parent re-rendersMoneyReportHeaderHoldMenu— extracted with an early-return guard so the heavy hold menu tree is never evaluated unless neededisSelectionModePaymentRef, unusedselectedTransactionIDs, and theclearSelectedTransactionscallback that was duplicated in the wrong scopeThe net result is MoneyReportHeader going from ~2448 lines to ~298 lines, with action logic owned by the hooks that have the right data access.
Fixed Issues
$ #87937
PROPOSAL:
Tests
Precondition:
Disable Approvals and Payments in Workflows settings.
Onyx.merge("report_{reportID}", {isExportedToIntegration: true})Offline tests
N/A
QA Steps
Precondition:
Workspace is connected to Sage Intacct.
Disable Approvals and Payments in Workflows settings.
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.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov