perf: stabilize iouReport in MoneyRequestReportPreview - #94188
Conversation
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@mananjadhav 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: 21ce85a219
ℹ️ 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".
| (allViolations: OnyxCollection<TransactionViolations>) => transactionViolationsByIDsSelector(transactionIDs)(allViolations), | ||
| [transactionIDs], | ||
| ); | ||
| const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {selector: selectTransactionViolations}); |
There was a problem hiding this comment.
Refresh violation selector when transaction IDs change
When this preview first mounts with transactions still empty, this useOnyx subscription is created with a selector closed over an empty transactionIDs list, but no dependency array is passed to useOnyx to refresh the subscription after the transactions hydrate. In that common loading path the selected violations stay empty, so compareByRBR falls back to date sorting and expenses with review-required/blocking violations are no longer moved to the front of the carousel (or into the first 10 visible previews) until the row remounts.
Useful? React with 👍 / 👎.
|
No product review needed |
|
@mananjadhav Can you review it? Thanks! |
|
I finished with the code review. Now onto testing. |
|
@OlimpiaZurek Can you please resolve conflicts? |
|
Thanks. Took the latest pull and testing now. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb Chromemweb-chrome-stabilize-render.moviOS: HybridAppios-stabilize-render.moviOS: mWeb Safarimweb-safari-stabilize-render.movMacOS: Chrome / Safariweb-stabilize-render.mov |
mananjadhav
left a comment
There was a problem hiding this comment.
I am having some trouble with my machine memory causing issue with Android builds and the last crash you see on iOS.
But the change tests well.
|
@OlimpiaZurek Can you please resolve the conflicts? thanks |
# Conflicts: # src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx
Done! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 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! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.25-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.4.25-2 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
This PR reduces unnecessary re-renders when sending a message in chats with several expense previews. Each
MoneyRequestReportPreviewre-subscribed to the linked IOU report, whose churninglast*fields re-emit on every send, so the previews re-rendered even though nothing they show changed.This PR passes the parent's already-stable
iouReport(getStableReportSelector) down the preview's render path instead of re-deriving it, so those subscriptions no longer fire on send/Fixed Issues
$ #93771
PROPOSAL:
Tests
hold menu, loading/empty/access placeholders); confirm Pay/Submit/Approve still work
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
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