perf: decouple toggleTransaction from filteredData#91188
Conversation
|
@codex review |
|
@MelvinBot review this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea436ac22d
ℹ️ 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".
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.
|
PR ReviewThe goal — removing 1. Unstable
|
There was a problem hiding this comment.
Pull request overview
This PR refactors Search selection handling so toggleTransaction no longer depends on filteredData, moving report-derivation logic into a dedicated sync hook in SearchContext.
Changes:
- Updated
SearchActionsContextValue.setSelectedTransactionsto remove thefilteredDataparameter and added a newsetSelectedReportsaction. - Added
deriveSelectedReports()+useSyncSelectedReports()to keepselectedReportssynchronized based on current selection and visible rows. - Updated Search UI header tests’ mocked Search actions context to include
setSelectedReports.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ui/CategoryListItemHeaderTest.tsx | Adds setSelectedReports to mocked Search actions context. |
| tests/ui/MerchantListItemHeaderTest.tsx | Adds setSelectedReports to mocked Search actions context. |
| tests/ui/MonthListItemHeaderTest.tsx | Adds setSelectedReports to mocked Search actions context. |
| tests/ui/WeekListItemHeaderTest.tsx | Adds setSelectedReports to mocked Search actions context. |
| tests/ui/YearListItemHeaderTest.tsx | Adds setSelectedReports to mocked Search actions context. |
| src/components/Search/types.ts | Adjusts setSelectedTransactions overloads and adds setSelectedReports to the actions contract. |
| src/components/Search/SearchContext.tsx | Introduces deriveSelectedReports + useSyncSelectedReports, and wires setSelectedReports into context. |
| src/components/Search/index.tsx | Uses useSyncSelectedReports(filteredData) and removes filteredData from toggleTransaction calls/deps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af9200ef44
ℹ️ 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".
|
Separating For example, the Change Approver modal is closed when adding 1 transaction to that report on another tab or device: 2026-05-21.18-26-53.mp4 |
|
@TMisiukiewicz we have conflicts |
a4d650c to
83a7f3a
Compare
|
@dmkt9 could you please check again Screen.Recording.2026-05-21.at.14.37.05.mov |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safarichrome.test.mp4 |
|
No product review needed |
…ransaction-from-filteredData # Conflicts: # config/eslint/eslint.seatbelt.tsv # src/components/Search/index.tsx # src/libs/actions/connections/MergeHR.ts
…ransaction-from-filteredData # Conflicts: # config/eslint/eslint.seatbelt.tsv # src/components/Search/index.tsx
|
🚧 @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.80-0 🚀
Bundle Size Analysis (Sentry): |
|
I reviewed the changes in this PR and no help site documentation updates are required. This PR is a purely internal performance optimization that decouples |
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.3.81-2 🚀
|
Explanation of Change
toggleTransactioninSearch/index.tsxpreviously hadfilteredDatain its dependency array because it calledsetSelectedTransactions(transactionIDs, filteredData)— the second arg was used to deriveselectedReportsfor bulk-action consumers (CSV export, bulk pay, bulk duplicate, etc.).
filteredDatais a large, reference-unstable array that changes on every search refresh, snapshot bump, filter tweak, or pagination. Any time it changed,toggleTransactionwas re-created, which churned every memoized child component that depended on it (row items, footer button, etc.).Fixed Issues
$ #91288
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
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
Screen.Recording.2026-05-21.at.09.40.16.mov