Reduce useonyx calls in transaction item#69416
Conversation
|
@dukenv0307 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] |
|
@dukenv0307 are you available for the review? |
|
@mountiny Yeah, I'll review in 10 minutes |
|
Looks good, left some minor comments |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-08-28.at.23.31.39.movAndroid: mWeb ChromeScreen.Recording.2025-08-28.at.23.30.38.moviOS: HybridAppScreen.Recording.2025-08-28.at.23.33.05.moviOS: mWeb SafariScreen.Recording.2025-08-28.at.23.29.51.movMacOS: Chrome / SafariScreen.Recording.2025-08-28.at.23.27.14.movMacOS: DesktopScreen.Recording.2025-08-28.at.23.33.58.mov |
|
There're some minor issues so when you resolve them we're good to merge |
|
@dukenv0307 I addressed your comments, thanks! |
|
@mountiny it's ready for review - I moved |
|
@mountiny kindly reminder about review 🙏 |
mountiny
left a comment
There was a problem hiding this comment.
Thanks! @martasudol there are conflicts now, but wanted to confirm, have you measured the performance on this branch and does it give the same benefits?
@mountiny conflicts resolved. I measured it and it gives the same benefits. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
…s-in-transaction-item Reduce useonyx calls in transaction item (cherry picked from commit 3bfe224) (cherry-picked to staging by francoisl)
|
🚀 Cherry-picked to staging by https://github.com/francoisl in version: 9.2.8-1 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
hi! as linked above - it looks like this might have caused #70256 - can we look into it please? @daledah has suggested an alternate solution, so we can investigate that as well rather than a revert. thanks! |
|
I see too late now you are moving ahead with the fix, but in case you will need the revert here it is #70317 @dangrous @francoisl |
|
Yeah we CP'ed this PR because it fixed another blocker, so reverting it would also reintroduce that other blocker 🙃 It's best if we go with a fix in this case. |
|
Ahaaa |
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.2.8-4 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/francoisl in version: 9.2.9-0 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Cherry-picked to staging by https://github.com/francoisl in version: 9.2.11-0 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.2.12-4 🚀
|
Explanation of Change
This PR reduces
useOnyxcalls in TransactionItemRowRBRWithOnyx by passing transaction's violations in props.Fixed Issues
$#67165
PROPOSAL: Reduce useOnyx calls on list-item level in TransactionItemRowRBRWithOnyx
Background:
The transaction list displays many items per report, each rendering with related data like violations. These components rely on hooks to fetch the data required for each item.
Problem:
When each transaction item makes multiple data subscriptions via useTransactionViolations hook, it causes excessive re-renders and slowness in large transaction lists.
Solution:
Move violation data fetching to the parent transaction list component to perform a single shared subscription. Pass the resulting violation data down as props (part of
transaction) to child components like TransactionItemRowRBRWithOnyx. This pattern reduces subscriptions from N×4 per report to 1, significantly improving rendering performance while preserving all existing functionality.Tests
Create a new expense with missing receipt
Verify: "Missing receipt" violation appears
Add the receipt
Verify: Violation disappears
Hold an expense
Verify: Hold status shows correctly
Verify that no errors appear in the JS console
Offline tests
Same as Tests.
QA Steps
Same as Tests.
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))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-native.mov
Android: mWeb Chrome
android-web.mov
iOS: Native
ios-native.mov
iOS: mWeb Safari
ios-web.mov
MacOS: Chrome / Safari
chrome-web.mov
MacOS: Desktop
desktop-aa.mov