Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/components/LHNOptionsList/LHNOptionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -84,6 +85,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio
policy={itemPolicy}
invoiceReceiverPolicy={itemInvoiceReceiverPolicy}
personalDetails={personalDetails ?? {}}
conciergeReportID={conciergeReportID}
Comment thread
BartekObudzinski marked this conversation as resolved.
Resolved
viewMode={optionMode}
isOptionFocused={!shouldDisableFocusOptions}
onSelectRow={onSelectRow}
Expand All @@ -92,12 +94,12 @@ 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(
() => [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);
Expand Down
2 changes: 1 addition & 1 deletion src/components/LHNOptionsList/OptionRowLHNData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function OptionRowLHNData({
personalDetails = {},
policy,
invoiceReceiverPolicy,
conciergeReportID,
...propsToForward
}: OptionRowLHNDataProps) {
const reportID = propsToForward.reportID;
Expand Down Expand Up @@ -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});
Expand Down
3 changes: 3 additions & 0 deletions src/components/LHNOptionsList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>;

/** TestID of the row, indicating order */
testID: number;
};
Expand Down
6 changes: 1 addition & 5 deletions src/components/Navigation/NavigationTabBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -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']);
Expand All @@ -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();

Expand Down
8 changes: 7 additions & 1 deletion src/hooks/useSidebarOrderedReports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -30,6 +32,7 @@ type SidebarOrderedReportsStateContextValue = {
orderedReports: OnyxTypes.Report[];
orderedReportIDs: string[];
currentReportID: string | undefined;
chatTabBrickRoad: BrickRoad;
};

type SidebarOrderedReportsActionsContextValue = {
Expand All @@ -42,6 +45,7 @@ const SidebarOrderedReportsStateContext = createContext<SidebarOrderedReportsSta
orderedReports: [],
orderedReportIDs: [],
currentReportID: '',
chatTabBrickRoad: undefined,
});

const SidebarOrderedReportsActionsContext = createContext<SidebarOrderedReportsActionsContextValue>({
Expand Down Expand Up @@ -300,15 +304,17 @@ function SidebarOrderedReportsContextProvider({
orderedReports: updatedReports,
orderedReportIDs: updatedReportIDs,
currentReportID: derivedCurrentReportID,
chatTabBrickRoad: getChatTabBrickRoad(updatedReportIDs, reportAttributes),
};
}

return {
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]);

Expand Down
Loading