Skip to content

Commit 700524d

Browse files
committed
remove reportsSelector to avoid heavy deepEquals
1 parent a055aea commit 700524d

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

src/pages/inbox/HeaderView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import useLocalize from '@hooks/useLocalize';
2929
import useOnyx from '@hooks/useOnyx';
3030
import useParentReportAction from '@hooks/useParentReportAction';
3131
import usePolicy from '@hooks/usePolicy';
32+
import useReportAttributes from '@hooks/useReportAttributes';
3233
import useReportIsArchived from '@hooks/useReportIsArchived';
3334
import useResponsiveLayout from '@hooks/useResponsiveLayout';
3435
import useSubscriptionPlan from '@hooks/useSubscriptionPlan';
@@ -85,7 +86,6 @@ import {callFunctionIfActionIsAllowed} from '@userActions/Session';
8586
import CONST from '@src/CONST';
8687
import ONYXKEYS from '@src/ONYXKEYS';
8788
import SCREENS from '@src/SCREENS';
88-
import reportsSelector from '@src/selectors/Attributes';
8989
import {isEmptyObject} from '@src/types/utils/EmptyObject';
9090

9191
type HeaderViewProps = {
@@ -117,7 +117,7 @@ function HeaderView({onNavigationMenuButtonClicked, reportID}: HeaderViewProps)
117117
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`);
118118
const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${report?.reportID}`, {selector: pendingChatMembersSelector});
119119
const isReportArchived = isArchivedReport(reportNameValuePairs);
120-
const [reportAttributes] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {selector: reportsSelector});
120+
const reportAttributes = useReportAttributes();
121121
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
122122
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
123123

src/selectors/Attributes.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import type {OnyxEntry} from 'react-native-onyx';
22
import type {ReportAttributesDerivedValue} from '@src/types/onyx';
33
import type {ReportAttributes} from '@src/types/onyx/DerivedValues';
44

5-
const reportsSelector = (attributes: OnyxEntry<ReportAttributesDerivedValue>) => attributes?.reports;
6-
75
const reportByIDsSelector = (reportIDs: string[]) => (attributes: OnyxEntry<ReportAttributesDerivedValue>) =>
86
reportIDs.reduce(
97
(acc, reportID) => {
@@ -16,5 +14,4 @@ const reportByIDsSelector = (reportIDs: string[]) => (attributes: OnyxEntry<Repo
1614
{} as Record<string, ReportAttributes>,
1715
);
1816

19-
export {reportByIDsSelector};
20-
export default reportsSelector;
17+
export default {reportByIDsSelector};

0 commit comments

Comments
 (0)