Decompose ReportScreen.tsx: extract isolated Onyx subscriptions#83331
Conversation
|
I'll rebase later leaving only |
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.
|
Replace COLLECTION.POLICY collection subscription with per-key lookup, extract DeleteTransactionNavigateBackHandler and AccountManagerBanner into isolated components to reduce re-renders (21 → 17 subscriptions). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bf13919 to
9e5e39e
Compare
|
@bernhardoj 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] |
|
Resolving conflicts now. |
waterim
left a comment
There was a problem hiding this comment.
Good stuff, LGTM!
Like the isolated subscriptions and change from policies to policy!
Accept upstream getParentReportActionDeletionStatus and isDeletedTransactionThread logic. Keep extracted DeleteTransactionNavigateBackHandler instead of upstream's inline useEffect, and add the doesDeleteNavigateBackUrlIncludeDuplicatesReview guard that upstream introduced. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e81280d1ac
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Wrap reportOnyx?.policyID with getNonEmptyStringOnyxID() to prevent subscribing to the entire policy collection when policyID is an empty string (valid state for non-workspace chats). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
TS Failing is not related, will resync with main |
getParticipantsAccountIDsForDisplay, getPersonalDetailsForAccountIDs, getDisplayNameOrDefault, and the handler allocations when the banner won't render.
|
Fixed obvious violations, was able to cut down on personal details parsing as well. All ready. |
Picked up styles.breakWord addition from main into AccountManagerBanner. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
bernhardoj
left a comment
There was a problem hiding this comment.
LGTM!
NOTE: we can use DeleteTransactionNavigateBackHandler in SearchMoneyRequestReportPage if we want.
|
🚧 @rlinoz 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/rlinoz in version: 9.3.27-0 🚀
|
|
@adhorodyski where do we check the following?
|
|
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.3.27-8 🚀
|
@rlinoz @mountiny
Explanation of Change
TLDR: these changes are low-harm and low-benefit, bringing down React rerenders during sending messages from ~43 to ~36. It saves on average ~5% during this operation. There should be no UI updates.
This PR decomposes
ReportScreen.tsxby extracting isolated Onyx subscriptions into dedicated renderless components, following the same pattern established in #83307 forExpensify.tsx. This reduces ReportScreen's subscription count from 21 to 17 and eliminates a collection-levelCOLLECTION.POLICYsubscription.Three specific changes are made:
Replace
COLLECTION.POLICYwith a per-key subscription — Instead of subscribing to the entire policy collection (which fires on any policy change across all workspaces), the component now subscribes directly to the specific policy viareportOnyx?.policyID. This avoids unnecessary re-renders triggered by unrelated workspace policy updates.Extract
DeleteTransactionNavigateBackHandler— A new renderless component that isolates theNVP_DELETE_TRANSACTION_NAVIGATE_BACK_URLsubscription and its cleanup effect, keeping that logic self-contained and out of ReportScreen's render scope.Extract
AccountManagerBanner— A self-contained component that moves 3 Onyx subscriptions (ACCOUNT_MANAGER_REPORT_ID, account manager report,PERSONAL_DETAILS_LIST), the lazy icon hook, banner state management, and Banner JSX out of ReportScreen.Fixed Issues
$ #77173
$ #77176
PROPOSAL:
Tests
AccountManagerBannerrendering correctly when triggered.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