From 08ae1c43018ca13f473e564e0728d49bf9b0e383 Mon Sep 17 00:00:00 2001 From: bartlomiej obudzinski Date: Fri, 10 Apr 2026 13:17:16 +0200 Subject: [PATCH 1/2] perf: hoist conciergeReportID and precompute chatTabBrickRoad in context --- src/components/LHNOptionsList/LHNOptionsList.tsx | 4 +++- src/components/LHNOptionsList/OptionRowLHNData.tsx | 2 +- src/components/LHNOptionsList/types.ts | 3 +++ src/components/Navigation/NavigationTabBar/index.tsx | 6 +----- src/hooks/useSidebarOrderedReports.tsx | 8 +++++++- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index 98e06f54bd37..e78304c48435 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -35,6 +35,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio const reportAttributes = useReportAttributes(); const [policy] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); + const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); const styles = useThemeStyles(); const estimatedItemSize = optionMode === CONST.OPTION_MODE.COMPACT ? variables.optionRowHeightCompact : variables.optionRowHeight; @@ -84,6 +85,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio policy={itemPolicy} invoiceReceiverPolicy={itemInvoiceReceiverPolicy} personalDetails={personalDetails ?? {}} + conciergeReportID={conciergeReportID} viewMode={optionMode} isOptionFocused={!shouldDisableFocusOptions} onSelectRow={onSelectRow} @@ -92,7 +94,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio /> ); }, - [reportAttributes, reports, policy, personalDetails, optionMode, shouldDisableFocusOptions, onSelectRow, onLayoutItem], + [reportAttributes, reports, policy, personalDetails, conciergeReportID, optionMode, shouldDisableFocusOptions, onSelectRow, onLayoutItem], ); const extraData = useMemo( diff --git a/src/components/LHNOptionsList/OptionRowLHNData.tsx b/src/components/LHNOptionsList/OptionRowLHNData.tsx index eeebcad4ea62..12ea344c206a 100644 --- a/src/components/LHNOptionsList/OptionRowLHNData.tsx +++ b/src/components/LHNOptionsList/OptionRowLHNData.tsx @@ -34,6 +34,7 @@ function OptionRowLHNData({ personalDetails = {}, policy, invoiceReceiverPolicy, + conciergeReportID, ...propsToForward }: OptionRowLHNDataProps) { const reportID = propsToForward.reportID; @@ -114,7 +115,6 @@ function OptionRowLHNData({ const [movedFromReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastAction, CONST.REPORT.MOVE_TYPE.FROM)}`); const [movedToReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(lastAction, CONST.REPORT.MOVE_TYPE.TO)}`); - const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${fullReport?.policyID}`); const card = useGetExpensifyCardFromReportAction({reportAction: lastAction, policyID: fullReport?.policyID}); diff --git a/src/components/LHNOptionsList/types.ts b/src/components/LHNOptionsList/types.ts index 90e8a30dffc6..f00e80454980 100644 --- a/src/components/LHNOptionsList/types.ts +++ b/src/components/LHNOptionsList/types.ts @@ -71,6 +71,9 @@ type OptionRowLHNDataProps = { /** The derived report attributes for all reports */ reportAttributesDerived?: ReportAttributesDerivedValue['reports']; + /** The concierge report ID, hoisted from list level to avoid per-item subscription */ + conciergeReportID: OnyxEntry; + /** TestID of the row, indicating order */ testID: number; }; diff --git a/src/components/Navigation/NavigationTabBar/index.tsx b/src/components/Navigation/NavigationTabBar/index.tsx index 3fd1fc684d89..6b7ad8e59fff 100644 --- a/src/components/Navigation/NavigationTabBar/index.tsx +++ b/src/components/Navigation/NavigationTabBar/index.tsx @@ -11,7 +11,6 @@ import {PressableWithFeedback} from '@components/Pressable'; import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; -import useReportAttributes from '@hooks/useReportAttributes'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useRootNavigationState from '@hooks/useRootNavigationState'; import {useSidebarOrderedReportsState} from '@hooks/useSidebarOrderedReports'; @@ -25,7 +24,6 @@ import isRoutePreloaded from '@libs/Navigation/helpers/isRoutePreloaded'; import Navigation from '@libs/Navigation/Navigation'; import {isDeletedAction} from '@libs/ReportActionsUtils'; import {startSpan} from '@libs/telemetry/activeSpans'; -import {getChatTabBrickRoad} from '@libs/WorkspacesSettingsUtils'; import navigationRef from '@navigation/navigationRef'; import type {ReportsSplitNavigatorParamList} from '@navigation/types'; import NavigationTabBarAvatar from '@pages/inbox/sidebar/NavigationTabBarAvatar'; @@ -56,7 +54,7 @@ function NavigationTabBar({selectedTab, isTopLevelBar = false, shouldShowFloatin const theme = useTheme(); const styles = useThemeStyles(); const {translate} = useLocalize(); - const {orderedReportIDs} = useSidebarOrderedReportsState(); + const {chatTabBrickRoad} = useSidebarOrderedReportsState(); const [isDebugModeEnabled] = useOnyx(ONYXKEYS.IS_DEBUG_MODE_ENABLED); const subscriptionPlan = useSubscriptionPlan(); const expensifyIcons = useMemoizedLazyExpensifyIcons(['ExpensifyAppIcon', 'Home', 'Inbox']); @@ -77,9 +75,7 @@ function NavigationTabBar({selectedTab, isTopLevelBar = false, shouldShowFloatin }; const [doesLastReportActionExist] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${lastReportRouteReportID}`, {selector: doesLastReportActionExistSelector}); - const reportAttributes = useReportAttributes(); const {shouldUseNarrowLayout} = useResponsiveLayout(); - const chatTabBrickRoad = getChatTabBrickRoad(orderedReportIDs, reportAttributes); const StyleUtils = useStyleUtils(); diff --git a/src/hooks/useSidebarOrderedReports.tsx b/src/hooks/useSidebarOrderedReports.tsx index 300112575f98..8ae7ad1a86bf 100644 --- a/src/hooks/useSidebarOrderedReports.tsx +++ b/src/hooks/useSidebarOrderedReports.tsx @@ -5,6 +5,8 @@ import Log from '@libs/Log'; import {getTransactionThreadReportID} from '@libs/MergeTransactionUtils'; import {isOneTransactionReport} from '@libs/ReportUtils'; import SidebarUtils from '@libs/SidebarUtils'; +import type {BrickRoad} from '@libs/WorkspacesSettingsUtils'; +import {getChatTabBrickRoad} from '@libs/WorkspacesSettingsUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type * as OnyxTypes from '@src/types/onyx'; @@ -30,6 +32,7 @@ type SidebarOrderedReportsStateContextValue = { orderedReports: OnyxTypes.Report[]; orderedReportIDs: string[]; currentReportID: string | undefined; + chatTabBrickRoad: BrickRoad; }; type SidebarOrderedReportsActionsContextValue = { @@ -42,6 +45,7 @@ const SidebarOrderedReportsStateContext = createContext({ @@ -300,6 +304,7 @@ function SidebarOrderedReportsContextProvider({ orderedReports: updatedReports, orderedReportIDs: updatedReportIDs, currentReportID: derivedCurrentReportID, + chatTabBrickRoad: getChatTabBrickRoad(updatedReportIDs, reportAttributes), }; } @@ -307,8 +312,9 @@ function SidebarOrderedReportsContextProvider({ orderedReports, orderedReportIDs, currentReportID: derivedCurrentReportID, + chatTabBrickRoad: getChatTabBrickRoad(orderedReportIDs, reportAttributes), }; - }, [getOrderedReportIDs, orderedReportIDs, derivedCurrentReportID, shouldUseNarrowLayout, getOrderedReports, orderedReports]); + }, [getOrderedReportIDs, orderedReportIDs, derivedCurrentReportID, shouldUseNarrowLayout, getOrderedReports, orderedReports, reportAttributes]); const actionsValue: SidebarOrderedReportsActionsContextValue = useMemo(() => ({clearLHNCache}), [clearLHNCache]); From 096b3503b8b2db671d3081f701989f1afbb24d9f Mon Sep 17 00:00:00 2001 From: bartlomiej obudzinski Date: Mon, 13 Apr 2026 08:46:28 +0200 Subject: [PATCH 2/2] perf: add conciergeReportID to extraData for FlashList invalidation --- src/components/LHNOptionsList/LHNOptionsList.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index e78304c48435..f66b80bb6e7c 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -98,8 +98,8 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio ); const extraData = useMemo( - () => [reports, reportAttributes, policy, personalDetails, data.length, optionMode, isOffline], - [reports, reportAttributes, policy, personalDetails, data.length, optionMode, isOffline], + () => [reports, reportAttributes, policy, personalDetails, conciergeReportID, data.length, optionMode, isOffline], + [reports, reportAttributes, policy, personalDetails, conciergeReportID, data.length, optionMode, isOffline], ); const previousOptionMode = usePrevious(optionMode);