[No QA] Reorder unread indicator predicates to short-circuit cheaply#94424
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@ZhenjaHorbach 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] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp2026-06-24.13.16.51.movAndroid: mWeb Chrome2026-06-24.13.17.53.moviOS: HybridApp2026-06-24.13.16.51.moviOS: mWeb Safari2026-06-24.13.17.53.movMacOS: Chrome / Safari2026-06-24.13.14.43.mov |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.19-1 🚀
Bundle Size Analysis (Sentry): |
|
🤖 No help site changes required. This PR is a pure internal performance refactor of As the PR description states, this is a "Pure reordering; the result set is identical" with no behavioral change:
Since nothing user-facing changed, there is nothing to document in @TMisiukiewicz, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR |
Explanation of Change
getUnreadReportsForUnreadIndicatorruns on every Onyx update (report, report-action, NVP, draft) and previously walked every report computing six locals up front — including the expensivegetOneTransactionThreadReportIDcall — before running the cheapest guards.This PR reorders the predicates to short-circuit as early as possible with no behavioral change:
isUnreadruns third.getOneTransactionThreadReportIDand the report-action/NVP lookups are deferred behind those three rejections.shouldReportBeInOptionList(the heaviest predicate) runs last — only for reports that are unread, non-muted, and non-hidden, which is a small fraction of the full report list.Perf gain on account with 100k reports:
getUnreadReportsForUnreadIndicatorgoes down from 1.1s to 400msFixed Issues
$ #94447
PROPOSAL:
Tests
Pure reordering; the result set is identical.
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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.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