perf: limit updated reports on transaction update in LHN#92072
perf: limit updated reports on transaction update in LHN#92072TMisiukiewicz wants to merge 1 commit into
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@aimane-chnaif 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] |
|
Can we have unit test? |
|
I've been doing regression test for various cases. No issue found |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid.movAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb SafariMacOS: Chrome / Safariweb.mov77579.movproduction.mov |
Regression reviewLikely regression of #73742 (fixed by #77579) in the multi-transaction expense report case. Confidence: medium. Root cause: The removed branch was the only mechanism in So when a receipt upload fails on a transaction whose parent expense report has 2+ transactions:
This is the exact scenario Evidence
Recommended fixKeep the perf intent but don't drop the thread invalidation. A few options, lightest first:
Also worth adding a hook-level test covering the multi-transaction receipt-upload failure path so this can't silently regress again. What I couldn't rule outYou report the test plan passes locally. Two paths that could be incidentally rescuing the flow:
A targeted re-test would be: fresh app start, open a multi-transaction expense report that contains the receipt-failing transaction, then trigger the failure — the LHN should still show RBR on the thread row even when that row was not previously visible. Next Steps: Reply with |
Explanation of Change
PR #77579 added logic in
getUpdatedReportsso that on each transaction update we resolved either the expense report or the transaction thread report (isOneTransactionReport+getTransactionThreadReportID). That ran for every entry intransactionsUpdates, which is costly when many transactions change at once (e.g. hydration / bulk merges) and contributed to high JS thread usage.This change restores the simpler mapping: invalidate only the report keyed by
transaction.reportID. Receipt-upload RBR and LHN inclusion are still handled inhasReportErrorsOtherThanFailedReceipt/getReceiptUploadErrorReasoninside SidebarUtils — this hook only decides which cached LHN rows to recompute incrementally.This highly reduces the CPU usage when user opens a money request report with a lot of transactions - having a report with 100+ transactions often means updating 100+ irrelevant reports.
Tested with the test plan from the PR that introduced it and looks like works well.
Fixed Issues
$ #92078
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
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))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
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-05-29.at.14.02.14.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-05-29.at.14.12.50.mov