[No QA] Avoid building archived-reports Set in findLastAccessedReport path#94146
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.
|
…et-in-find-last-accessed-report # Conflicts: # src/pages/OnboardingPersonalDetails/BaseOnboardingPersonalDetails.tsx
|
@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-22.15.01.35.movAndroid: mWeb Chrome2026-06-22.14.58.02.moviOS: HybridApp2026-06-22.15.01.35.moviOS: mWeb Safari2026-06-22.14.58.02.movMacOS: Chrome / Safari2026-06-22.14.55.34.mov |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @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! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.17-0 🚀
Bundle Size Analysis (Sentry): |
|
🤖 I reviewed the changes in this PR against the help site files under No help site changes are required. This is a pure internal performance refactor with no user-facing impact:
There are no new features, settings, tab/button labels, copy, or UI/behavior changes — nothing the help site documents. The PR is also marked Since no documentation updates are needed, I did not create a draft docs PR — so there is no linked help site PR to review. @TMisiukiewicz, if you believe a behavior change here should be reflected in the help site, let me know and I'll draft the corresponding docs PR. |
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.4.17-3 🚀
|
1 similar comment
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.4.17-3 🚀
|
Explanation of Change
findLastAccessedReportpreviously received a pre-builtArchivedReportsIDSet(aSetcovering all archived report IDs), which forced every caller to first build that set by iterating the fullreportNameValuePairscollection — expensive at scale (we have a state with ~100k entries).This PR changes the 4th parameter to accept the raw
OnyxCollectioninstead. The archived check is now a direct per-report key lookup (isArchivedReport(reportNameValuePairsCollection?.[key])), which is O(1) and requires no up-front Set construction. All callers are updated to pass the collection they already subscribe to viauseOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS). A module-scopedOnyx.connectfallback is kept for the rare cases where no collection is passed.useArchivedReportsIDSet/buildArchivedReportsIDSetare left in place for other existing consumers.Performance impact (100k reports account): -14s on app startup and opening report
Fixed Issues
$ #94166
PROPOSAL:
Tests
No tests needed, pure refactor
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