Repository navigation
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.
|
|
If this requires C+ review, I am available |
|
@aimane-chnaif go for it |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a91b37e3ae
ℹ️ 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".
|
|
||
| const chatReportForTransactionThread = chatReport ?? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`]; | ||
| const transactionThreadReportID = reportID ? getOneTransactionThreadReportID(report, chatReportForTransactionThread, allSortedReportActions[reportID]) : undefined; | ||
| const transactionThreadReportID = reportID ? cachedOneTransactionThreadReportIDs[reportID] : undefined; |
There was a problem hiding this comment.
Recompute transaction-thread lookup when report data updates
getLastMessageTextForReport() now relies exclusively on cachedOneTransactionThreadReportIDs, but that cache is only populated inside the REPORT_ACTIONS subscription. If report/chatReport is unavailable when that callback runs (or if chatReportID is updated later), the cached value stays undefined and we stop including transaction-thread actions in preview generation for one-transaction reports, so LHN/search previews can show stale parent-report text until another report-action update happens.
Useful? React with 👍 / 👎.
| // If the report is a one-transaction report, we need to return the combined reportActions so that the LHN can display modifications | ||
| // to the transaction thread or the report itself. |
There was a problem hiding this comment.
Keep original comment as well
There was a problem hiding this comment.
Done, restored the original comment.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-03-10.at.3.43.05.pm.mov |
| const chatReportForTransactionThread = chatReport ?? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`]; | ||
| const transactionThreadReportID = reportID ? getOneTransactionThreadReportID(report, chatReportForTransactionThread, allSortedReportActions[reportID]) : undefined; | ||
| const transactionThreadReportID = reportID ? cachedOneTransactionThreadReportIDs[reportID] : undefined; | ||
|
|
There was a problem hiding this comment.
chatReport is only used to get send money action which is not much used.
App/src/libs/ReportActionsUtils.ts
Lines 1808 to 1812 in 0ff5265
This flow test well though
There was a problem hiding this comment.
Confirmed. The cache is populated in the REPORT_ACTIONS Onyx callback which already has access to allReports, so chatReport is resolved there. The only edge case would be a chatReportID update without a corresponding REPORT_ACTIONS change, but that does not happen in practice since chatReportID is set at report creation time.
|
🚧 @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! 🧪🧪
|
|
✋ 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/JS00001 in version: 9.3.36-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.3.36-10 🚀
|
Explanation of Change
This PR targets the
ManualNavigateToInboxTabmetric (BottomTab click to Inbox layout completion) by eliminating redundant computational work during LHN renderItem and sidebar sorting.1. O(n) scan for
getLastVisibleAction(ReportActionsUtils.ts)Replaced two O(n log n) sorts followed by taking the first element with a single O(n) linear scan using an
isNewerReportActioncomparator. For reports with many actions (e.g. 581 actions), this reduces per-item cost from ~24ms to ~2ms.2. Cache
cachedOneTransactionThreadReportIDs(OptionsListUtils/index.ts)Pre-computes
getOneTransactionThreadReportIDresults inside the existing OnyxREPORT_ACTIONScallback and stores them for O(1) lookup inrenderItem, replacing a runtime O(n) call per item.3. Remove dead
chatReportparameter cascadeWith the cache replacing the only consumer of
chatReportingetLastMessageTextForReport, the parameter was removed from the entire function chain:createOption,processReport,createOptionFromReport,getPolicyExpenseReportOption,getReportDisplayOption,getLastMessageTextForReport, and all their callers (13 files total). Also removed an unnecessaryuseOnyxsubscription from theuseUserToInviteReportshook that was only needed to passchatReport.4.
SidebarUtilssorting optimizations (SidebarUtils.ts)categorizeReportsForLHNinto a single loop, eliminating ~500 intermediate objects per call..sort()for arrays with fewer than 2 items (pinned/GBR/error/draft lists are usually very small).combineReportCategorieswith a direct push loop, eliminating 2 intermediate arrays.Reassure benchmark results:
getSearchOptions: -47.8% durationgetReportsToDisplayInLHN: -12.7% durationFixed Issues
$ #77175
PROPOSAL:
Tests
Offline tests
QA Steps
same as test
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
Screen.Recording.2026-03-10.at.15.46.49.mov
Android: mWeb Chrome
Screen.Recording.2026-03-10.at.15.47.25.mov
iOS: Native
Screen.Recording.2026-03-10.at.15.44.36.mov
iOS: mWeb Safari
Screen.Recording.2026-03-10.at.15.45.18.mov
MacOS: Chrome / Safari
Screen.Recording.2026-03-10.at.15.42.46.mov