[No QA] Perf: Extract Search and Workspaces tab buttons to isolate Onyx subscriptions#82902
Conversation
…orkspaces-tab-buttons # Conflicts: # src/components/Navigation/NavigationTabBar/index.tsx
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
| @@ -0,0 +1,13 @@ | |||
| import type {ThemeColors} from '@styles/theme/types'; | |||
|
|
|||
| function getTabIconFill(theme: ThemeColors, isSelected: boolean, isHovered: boolean): string { | |||
There was a problem hiding this comment.
2nd and 3rd arguments can be a config object instead in case you wan to add more later
adhorodyski
left a comment
There was a problem hiding this comment.
can't tell you how much I love it
|
|
||
| function getLastRoute(rootState: NavigationState, navigator: ValueOf<typeof NAVIGATORS>, screen: Screen) { | ||
| const lastNavigator = rootState.routes.findLast((route) => route.name === navigator); | ||
| const lastNavigatorState = lastNavigator && lastNavigator.key ? getPreservedNavigatorState(lastNavigator?.key) : undefined; |
There was a problem hiding this comment.
NAB:
I know this code was moved from somewhere else not written by you, but I think this would be enough 😄
lastNavigator?.key ? getPreservedNavigatorState(lastNavigator?.key) : undefined;
There was a problem hiding this comment.
the ? inside of () is actually redundant, already present inside the first ?: ternary block
…meters and simplify last route retrieval logic
|
@ChavdaSachin 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] |
|
Does this need my review? |
|
@ChavdaSachin could you run through the checklist please? |
|
Lemme take a quick look at code and complete the checklist then. |
Reviewer Checklist
Screenshots/VideosNA |
|
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @JS00001 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/JS00001 in version: 9.3.24-1 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.3.24-3 🚀
|
Explanation of Change
This PR extracts
SearchTabButtonandWorkspacesTabButtoninto separate components fromNavigationTabBar, isolating approximately 33 Onyx subscriptions from the parent component's render path. This prevents unnecessary re-renders of the NavigationTabBar when Onyx data specific to these tabs changes.The performance improvement is measurable: the
ManualNavigateToInboxTabtelemetry span improved by ~220ms (measured 10x on the same edge case scenario).This is purely a structural optimization with no functional changes. The button behavior, accessibility, and visual appearance remain identical.
Fixed Issues
$ #82940
PROPOSAL:
Tests
Offline tests
N/A
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))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