perf: hoist transaction violations for MoneyRequestReportTransactionList items - #91958
Conversation
|
@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] |
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.
|
Code ReviewOverview: Hoists per-row Verdict: Looks good. The refactor is minimal, behavior‑preserving for other callers, and meaningfully reduces FlashList subscription overhead. A few notes below. Correctness
Potential downsides worth being aware of
Minor nits
Verification suggestions
Security / data flowNo new data exposed, no API surface changes, no auth/permission logic touched. The user‑visibility filter ( |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
Regression scanI didn't find any correctness regression that should block this PR. The behavior‑preservation argument holds:
That said, there are a few performance regression risks worth being aware of, because some of them are subtle and could show up as field issues on large reports. Potential performance regressions1) Whole‑map rebuild on any 2) Map rebuilds on 3) Fresh array reference for unchanged violation rows. Even within the same memo run, every transaction whose filter result is non‑empty gets a brand‑new array allocated by 4) Other regression‑adjacent observations
Verification suggestions
Overall: the change is a net win for steady‑state subscription cost on a virtualized list, but it trades narrower per‑row updates for broader parent re‑renders. The risks above are unlikely to be deal‑breakers, but worth knowing so you can react quickly if perf telemetry regresses post‑deploy. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid.movAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb SafariMacOS: Chrome / Safariweb.mov |
|
🚧 @mountiny 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/mountiny in version: 9.3.90-0 🚀
Bundle Size Analysis (Sentry): |
Help site review: no changes requiredI reviewed the changes in this PR and no updates to the help site ( Why: This is a pure performance refactor with no user-facing behavior change. It hoists transaction-violation filtering out of per-row The help site documents user-facing features, settings, and workflows. Since none of those changed here — no new feature, no renamed labels/tabs/buttons, no altered behavior — there is nothing to document. Files reviewed
All five files are internal implementation/test changes with no user-facing surface. |
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.3.90-3 🚀
|
Explanation of Change
On the expense report transaction list, each row called
useTransactionViolations, which subscribes to Onyx per transaction 4 times.With many rows in a virtualized list, that becomes N rows × several subscriptions. Any Onyx update can trigger re-renders across many rows, and list recycling keeps those subscriptions active while scrolling. That matches the general anti-pattern of calling
useOnyxinside list item render paths (see PERF-3 in coding standards).The parent list (
MoneyRequestReportTransactionList) already subscribed to the fullTRANSACTION_VIOLATIONScollection for RBR sorting, but each row still duplicated work with its own hooks.This PR hoists transaction violation filtering from per-row useOnyx subscriptions to the report transaction list’s existing bulk violations subscription, reducing list subscription overhead and stabilizing row props for FlashList.
Fixed Issues
$ #91963
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
iOS: mWeb Safari
MacOS: Chrome / Safari