Repository navigation
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@linhvovan29546 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.
Pull request overview
This PR reduces unnecessary re-renders in Search results by removing the prop-drilled subscription to the entire TRANSACTION_VIOLATIONS Onyx collection and instead subscribing to violations at the individual transaction row level.
Changes:
- Removed the
violationscollection prop fromSearch -> SearchList -> ListItemplumbing to keeprenderItemdeps stable. - Updated
TransactionListItemto subscribe toTRANSACTION_VIOLATIONSfor its owntransactionIDand use that for filtering/merging violations. - Adjusted Search list item prop types to reflect the new violations data flow (row-scoped vs. group-expanded-specific).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/components/Search/SearchList/ListItem/types.ts |
Removes violations from row/group item props and scopes it to expanded group props only. |
src/components/Search/SearchList/ListItem/TransactionListItem.tsx |
Subscribes to per-transaction Onyx violations and passes merged violations to TransactionItemRow. |
src/components/Search/SearchList/index.tsx |
Removes the violations prop from SearchListProps and from renderItem propagation/deps. |
src/components/Search/index.tsx |
Stops passing violations into SearchList, preventing list-wide invalidations from violations collection reference changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| queryJSON={queryJSON} | ||
| columns={columnsToShow} | ||
| violations={violations} | ||
| onLayout={onLayout} |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApptelegram-cloud-document-5-6066442049182245846.mp4Android: mWeb Chrometelegram-cloud-document-5-6066442049182245847.mp4iOS: HybridAppScreen.Recording.2026-05-14.at.15.05.24.moviOS: mWeb SafariScreen.Recording.2026-05-14.at.14.47.23.movMacOS: Chrome / SafariScreen.Recording.2026-05-14.at.14.43.43.mov |
@TMisiukiewicz After testing, I still see the visible items re-rendering when violation change, just like before. I tested this on both |
|
@linhvovan29546 from my investigation, they still rerender because of the other props that change, not because of violations. I'm working on making them stable one by one |
…ations-per-row # Conflicts: # src/components/Search/SearchList/ListItem/TransactionListItem.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.74-7 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required. This PR is a performance optimization that moves the |
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.3.74-7 🚀
|
| const [parentReport] = originalUseOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(transactionItem.reportID)}`); | ||
| const [transactionThreadReport] = originalUseOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transactionItem?.reportAction?.childReportID}`); | ||
| const [transaction] = originalUseOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${getNonEmptyStringOnyxID(transactionItem.transactionID)}`); | ||
| const [transactionViolationsForRow] = originalUseOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${getNonEmptyStringOnyxID(transactionItem.transactionID)}`); |
There was a problem hiding this comment.
Hi! This PR caused a regression: #103624
What happened: Before this PR, Search/index.tsx read violations through the App's useOnyx wrapper (@hooks/useOnyx). On Search, that wrapper falls back to the search snapshot for transactionViolations_. This PR moved the read into each row with originalUseOnyx (the raw useOnyx from react-native-onyx). That hook only reads live Onyx and ignores the snapshot.
Result: In Spend > Expenses, the row shows no violations for an expense whose violations aren't in live Onyx yet (for example, one you haven't opened). The Search API had already returned them in the snapshot. They only appeared after opening the expense, which loads them into live Onyx.
Fix: #103690 keeps the per-row subscription but falls back to the snapshot when live Onyx has no violations for that transaction:
const transactionViolationsForRow = liveTransactionViolations ?? snapshotData?.[transactionViolationsKey];
Takeaway: When you move a Search read from useOnyx to a raw or WithoutSnapshots subscription, check whether that key is snapshot-backed (runtimeConfigured.ts). If it is, keep a snapshot fallback, as this row already does for the policy and chat report.

Explanation of Change
The parent
<SearchList>component subscribes touseOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS)— the entire violations collection. That collection reference was prop-drilled through<ListItem>down to<TransactionListItem>and onto all 5 row components. OnlyTransactionListItemactually consumed it. Any violation change anywhere in the account flipped the wide collection reference, invalidatedrenderItem's deps, and re-rendered every visible row regardless of type..Fixed Issues
$ #90481
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: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-05-13.at.13.22.53.mov