perf: Migrate to Flashlist in MoneyRequestReportTransactionList#91422
perf: Migrate to Flashlist in MoneyRequestReportTransactionList#91422TMisiukiewicz wants to merge 20 commits into
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.
|
|
@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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b5c9bef51
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Migrates the Money Request report view to a single unified, virtualized list (FlashList) so transaction rows are no longer eagerly rendered inside a header, improving open-time and scroll performance on large reports.
Changes:
- Introduced a controller/render-prop in
MoneyRequestReportTransactionListto provide transaction UI + items for a unified parent list. - Replaced the report actions FlatList with a FlashList that interleaves transactions, a transactions footer, and report actions in one dataset.
- Added dedicated components for horizontal scroll restoration and the transaction long-press selection modal.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/components/MoneyRequestReportView/MoneyRequestReportTransactionLongPressModal.tsx | Adds an imperative long-press modal to enter selection mode and select a transaction. |
| src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx | Refactors transaction list into a controller that supplies items + chrome for a unified parent FlashList. |
| src/components/MoneyRequestReportView/MoneyRequestReportHorizontalScrollWrapper.tsx | Extracts horizontal scroll + offset restoration logic for wide table layouts. |
| src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx | Builds the unified FlashList (transactions + footer + report actions) and wires viewability/scroll behaviors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| visibleReportActions={visibleReportActions} | ||
| renderReportAction={renderReportAction} | ||
| linkedReportActionID={linkedReportActionID} | ||
| listRef={reportScrollManager.ref as unknown as React.Ref<FlashListRef<UnifiedListItem>>} |
There was a problem hiding this comment.
Can we improve this typing? This typecast is not preferred.
There was a problem hiding this comment.
The cast reflects an architectural seam - the shared ActionListContext was built around FlatList, but this screen uses FlashList. The runtime types are compatible (same scroll methods), but properly removing the cast requires reshaping the shared context, which would touch a lot of other files that are not relevant to this migration. Do you think we can leave it as-is here?
There was a problem hiding this comment.
Sure. This kind of issues can be always follow-up.
|
I noticed several issues but only reporting the regressions not happening in production. Bug: Tapping "Latest message" badge doesn't jump to latest message Screen.Recording.2026-05-26.at.1.08.18.PM.movBug: While scrolling fast, empty content briefly shows (Tested on 40 expenses) Screen.Recording.2026-05-26.at.12.57.14.PM.mov |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03ce2973ca
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| initialScrollIndex={initialScrollIndex} | ||
| onViewableItemsChanged={onViewableItemsChangedAdjusted} |
There was a problem hiding this comment.
Preserve linked action anchoring when opening a report
Replacing initialScrollKey behavior with plain initialScrollIndex in MoneyRequestReportUnifiedList can break deep-link/open-at-action flows for long reports: initialScrollIndex is only an initial mount hint, so once pagination/backfill mutates data (and this list has a large dynamic ListHeaderComponent), the linked action is no longer reliably anchored and users can land away from the targeted message. The previous list wrapper handled key-based anchoring across data expansion; this version computes a one-time index and does not provide a stable post-mount anchor path.
Useful? React with 👍 / 👎.
|
Investigating the reported bugs ⌛ |
|
@mountiny could you run an adhoc to verify if empty cells bug is development only |
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
🚧 @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! 🧪🧪
|
Explanation of Change
Problem
On heavy money-request reports the RHP list was effectively non-virtualised. The inner transactions section was rendered via plain
.map()inside the parent FlatList'sListHeaderComponent, which renders eagerly. Every transaction row mounted synchronously when the report opened, pushing report open time to ~20–30s for a report with 1600 expenses and producing a noticeable jank window on every navigation.Solution
Unified list — merged the inner transactions section and the outer report-actions section into a single virtualised list. A discriminated-union
UnifiedListItem(section-header|transaction|transactions-footer|report-action) flows through onerenderItemdispatcher, so transactions and chat messages now share the same recycler window instead of one being eagerly rendered inside the other's header.FlashList — migrated the list from
react-native'sFlatList(FlatListWithScrollKey).initialScrollIndexreplaces the FlatList-specificuseFlatListScrollKeywrapperController + sub-component —
MoneyRequestReportTransactionListcontinues to own the transaction-domain state (sort, group-by, selection, columns, totals, etc.) and exposes it to the parent via a render-prop controller. The parent renders a smallMoneyRequestReportUnifiedListsub-component that assembles the FlashList from controller data plus the report-actions listFixed Issues
$ #91425
PROPOSAL:
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov