perf: defer mount of MoneyReportHeaderSecondaryActions#88522
Conversation
…er-MoneyReportHeaderSecondaryActions
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid-mweb.movAndroid: mWeb Chromeandroid-mweb.moviOS: HybridAppios.moviOS: mWeb Safariios-mweb.movMacOS: Chrome / Safariweb.mov |
|
PR doesn’t need product input as a performance PR. Unassigning and unsubscribing myself. |
|
I found a bug during testing that can be reproduced on staging and in production, so I reported the bug here. |
rlinoz
left a comment
There was a problem hiding this comment.
lets get some general aligment about this pattern https://expensify.slack.com/archives/C05LX9D6E07/p1776885076125729?thread_ts=1776703191.332799&cid=C05LX9D6E07
…tHeaderSecondaryActions
…tHeaderSecondaryActions
fa2130e to
78abe59
Compare
|
🚧 @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. |
Explanation of Change
Introduces a generic
DeferredMountcomponent that defers mounting itschildrenuntil after the first paint, wrapping the mount instartTransitionso React can yield to user input and animations while the heavy tree hydrates.MoneyReportHeaderSecondaryActionsis applied as the first consumer. Before this change, it eagerly ran 20+useOnyxsubscriptions and several domain hooks (useExpenseActions,useExportActions,useHoldRejectActions,useLifecycleActions,useTransactionsAndViolationsForReport,usePaginatedReportActions, etc.) on the very first render — just so a non-critical "More" dropdown could exist immediately. WithDeferredMount, a visually identical placeholderButtonrenders first; the realButtonWithDropdownMenuhydrates in the background after the screen is painted.The placeholder uses the same
innerStyles(getDropDownButtonHeight(MEDIUM)+dropDownButtonCartIconView) andflex1wrapper (on narrow layout, when there is no primary action) as the hydrated component, so there is zero width or text-position shift on the swap.Measured impact:
Fixed Issues
$ #88524
$ #77173
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
iosd.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov