Repository navigation
[No QA] perf: skip approval rules scan in chat room subtitle when the workspace name is shown - #108319
Conversation
|
@DylanDylann 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] |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
PR doesn’t need product input as a refactor PR. Unassigning and unsubscribing myself. |
| expect(result).toBe(policy.name); | ||
| }); | ||
|
|
||
| it('should not read approval rules for a policy expense chat when the workspace name is shown', () => { |
There was a problem hiding this comment.
This does not test the feature as intended, I think we could even have no tests here
There was a problem hiding this comment.
Either way works for me
There was a problem hiding this comment.
ok, dropped the test
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
DylanDylann
left a comment
There was a problem hiding this comment.
Straightforward. LGTM
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 JS00001 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! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/JS00001 in version: 9.5.57-0 🚀
|
|
No help site update needed — this PR only skips an unnecessary approval-rule lookup; displayed subtitles and user workflows remain unchanged. |
Explanation of Change
getChatRoomSubtitlelooked up who the user's own workspace chat submits to, which goes throughgetSubmitToEmailtogetForwardsToFromRulesand loops over every approval rule in the account. WhenisPolicyNamePreferredis false it then threw that result away and returned the workspace name. The LHN (SidebarUtils.getOptionData), the report header (HeaderView),ReportDetailsNameSection,ShareCodePageandTaskall take that path, so every render of an own workspace chat row paid for a full rules scan it never used.This PR returns the workspace name before the lookup when
isPolicyNamePreferredis false. The result is the same for every caller. Callers that passtrue(OptionsListUtils,AvatarWithDisplayName) still get the "submits to" text.Performance gain:
Measured with the real data from a large production account (282,164 rules across 2,865 workspaces, 25 own workspace chats), calling
getChatRoomSubtitlethe way the LHN does, in Jest on an M-series Mac:A Reassure benchmark with the same shape (282,164 rules across 2,865 workspaces, one own workspace chat, called the way the LHN calls it) went from 83.4 ms to 0.0 ms.
The saving applies each time an own workspace chat subtitle is built: its LHN row and the header of that chat. On the account above, the cold Inbox tab span on web did not change, because in its focus mode the own workspace chats sort below the first rendered rows.
Fixed Issues
$ #108322
PROPOSAL: N/A
Tests
npx jest tests/unit/ReportUtilsTest.ts -t getChatRoomSubtitleand verify all tests pass, includingshould not read approval rules for a policy expense chat when the workspace name is shownOffline tests
Same as tests. The change has no network dependency.
QA Steps
None. The subtitle text is unchanged, so there is nothing new for QA to check.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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.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
🤖 Generated with Claude Code