-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Coming from proposal here
Background:
The LHN renders a scrollable list of all user-visible reports via a FlashList renderItem callback. For each report row, renderItem derives several values from that report's actions: the last visible action, the last displayable action, the one-transaction thread report ID, and the last IOU money request action. Report actions are stored as unsorted objects in Onyx. A collection-level Onyx callback on ONYXKEYS.COLLECTION.REPORT_ACTIONS already fires on every data change and iterates over all report-action collections to maintain pre-computed caches (allSortedReportActions, lastReportActions, lastVisibleReportActions). Additionally, the reportAttributes OnyxDerived config already computes per-report metadata reactively whenever its Onyx dependencies change.
Problem:
When the LHN re-renders on a heavy account, each renderItem call independently performs two sort operations, a filter pass, and a find scan over that report's actions, which slows down initial navigation to the inbox and degrades scroll frame rates as the number of reports grows
Solution:
- Expose oneTransactionThreadReportID through the existing reportAttributes OnyxDerived config which already computes it but was discarding it so renderItem reads it reactively instead of calling getOneTransactionThreadReportID() per item.
- Merge the .filter() and .find() passes in the REPORT_ACTIONS collection callback into a single for loop with early break, caching results in lastVisibleReportActions and lastVisibleIOUMoneyActions.
- Replace the two per-item sort calls with a single-pass findLastReportActions() using an isNewerReportAction comparator, reducing per-item complexity
Draft PR
Performance gain:
ManualNavigateToInboxTab span reduced ~30ms
Issue Owner
Current Issue Owner: @bfitzexpensifyUpwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022024766686700575645
- Upwork Job ID: 2024766686700575645
- Last Price Increase: 2026-03-02
Metadata
Metadata
Labels
Type
Projects
Status