Defer policy expense chat report actions computation off the render path#93781
Defer policy expense chat report actions computation off the render path#93781TMisiukiewicz wants to merge 10 commits into
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 534c33bed8
ℹ️ 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".
|
Tests are failing |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppScreen.Recording.2026-06-17.at.14.28.07.moviOS: mWeb SafariScreen.Recording.2026-06-17.at.14.30.18.movMacOS: Chrome / SafariScreen.Recording.2026-06-17.at.14.24.19.mov |
abzokhattab
left a comment
There was a problem hiding this comment.
I think the failing test is not related ... lets merge to main .. other than that the changes looks good to me 🚀🚀
…nse-chat-report-actions
|
lets see now |
|
@TMisiukiewicz can you sync again? |
…nse-chat-report-actions
|
@mountiny done |
Explanation of Change
Previously,
useAllPolicyExpenseChatReportActionsbuilt a filtered map of policy-expense-chat report actions on every render and was consumed by 5 components. The filtered map was only ever needed inside event-handler callbacks, not during render, so this work was wasted on every render cycle.This PR:
getAllPolicyExpenseChatReportActions(allReports, allReportActions)insrc/libs/ReportUtils.tsuseSearchBulkActions,DynamicReportChangeWorkspacePage,WorkspaceInviteMessageComponent,useExpenseSubmission) to call the function lazily inside the callback that actually needs ituseAllPolicyExpenseChatReportActions.tshookNo behavior change — purely moves computation from the render path into callbacks where it's actually used.
Performance gain: Heavy account, 4x CPU throttle:
KYCWallcomponent goes from 275ms to 15ms on a single "Pay" button pressFixed Issues
$ #93788
PROPOSAL:
Tests
Web only:
Offline tests
N/A
QA Steps
Same as tests
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
web.mov