Skip to content
Draft
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
4 changes: 2 additions & 2 deletions __mocks__/react-native-onyx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import type {ConnectOptions, OnyxKey} from 'react-native-onyx';

// eslint-disable-next-line no-restricted-imports
import Onyx, {useOnyx} from 'react-native-onyx';
import Onyx, {useOnyx, useOnyxState} from 'react-native-onyx';

let connectCallbackDelay = 0;
function addDelayToConnectCallback(delay: number) {
Expand Down Expand Up @@ -41,4 +41,4 @@ const reactNativeOnyxMock: ReactNativeOnyxMock = {

export default reactNativeOnyxMock;

export {useOnyx};
export {useOnyx, useOnyxState};
2 changes: 1 addition & 1 deletion config/eslint/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ const config = defineConfig([
// here too (flat config is last-wins per rule, not additive).
{
files: ['**/*.ts', '**/*.tsx'],
ignores: ['src/libs/actions/OnyxDerived/configs/reportAttributes.ts'],
ignores: ['src/libs/ReportAttributesComputeUtils.ts'],
rules: {
'no-restricted-imports': [
'error',
Expand Down
4 changes: 1 addition & 3 deletions config/eslint/eslint.seatbelt.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,6 @@
"../../src/libs/actions/OdometerTransactionUtils.ts" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/libs/actions/OnyxDerived/configs/guideAccountIDs.ts" "rulesdir/no-direct-personal-details-list" 1
"../../src/libs/actions/OnyxDerived/configs/loginToAccountIDMap.ts" "rulesdir/no-direct-personal-details-list" 1
"../../src/libs/actions/OnyxDerived/configs/reportAttributes.ts" "rulesdir/no-direct-personal-details-list" 2
"../../src/libs/actions/OnyxDerived/index.ts" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/libs/actions/OnyxUpdateManager/index.ts" "@typescript-eslint/no-unsafe-type-assertion" 3
"../../src/libs/actions/OnyxUpdateManager/utils/__mocks__/applyUpdates.ts" "no-restricted-syntax" 1
Expand Down Expand Up @@ -720,6 +719,7 @@
"../../src/libs/ComposerFocusManager.ts" "@typescript-eslint/no-deprecated/TextInput.State.currentlyFocusedField" 1
"../../src/libs/ComposerFocusManager.ts" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/libs/ComposerUtils/index.ts" "no-restricted-syntax" 1
"../../src/libs/computeReportAttributes.ts" "rulesdir/no-direct-personal-details-list" 2
"../../src/libs/CountryUtils.ts" "@typescript-eslint/no-unsafe-type-assertion" 2
"../../src/libs/CurrencyUtils.ts" "rulesdir/no-onyx-connect" 1
"../../src/libs/DateUtils.ts" "@typescript-eslint/no-unsafe-type-assertion" 3
Expand Down Expand Up @@ -2065,10 +2065,8 @@
"../../tests/unit/ReportSecondaryActionUtilsTest.ts" "no-restricted-imports" 2
"../../tests/unit/ReportTitleUtilsTest.ts" "no-restricted-imports" 1
"../../tests/unit/ReportUtilsTest.ts" "no-restricted-imports" 1
"../../tests/unit/SearchAutocompleteListTest.tsx" "@typescript-eslint/no-restricted-imports" 1
"../../tests/unit/SidebarUtilsTest.ts" "no-restricted-imports" 1
"../../tests/unit/TransactionTest.ts" "@typescript-eslint/no-restricted-imports" 1
"../../tests/unit/WorkspacesSettingsUtilsTest.ts" "@typescript-eslint/no-restricted-imports" 1
"../../tests/utils/createMock.ts" "@typescript-eslint/no-unsafe-type-assertion" 1
"../rsbuild/CustomVersionFilePlugin.ts" "@typescript-eslint/no-unsafe-type-assertion" 1
"../rsbuild/ModuleInitTimingPlugin.ts" "@typescript-eslint/no-unsafe-type-assertion" 1
Expand Down
6 changes: 2 additions & 4 deletions config/oxlint/oxlint.seatbelt.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,6 @@
"../../src/libs/actions/OnyxDerived/configs/cardFeedErrors.ts" "@typescript-eslint/no-unnecessary-type-assertion" 1
"../../src/libs/actions/OnyxDerived/configs/guideAccountIDs.ts" "rulesdir/no-direct-personal-details-list" 1
"../../src/libs/actions/OnyxDerived/configs/loginToAccountIDMap.ts" "rulesdir/no-direct-personal-details-list" 1
"../../src/libs/actions/OnyxDerived/configs/reportAttributes.ts" "rulesdir/no-direct-personal-details-list" 2
"../../src/libs/actions/OnyxDerived/index.ts" "@typescript-eslint/no-unnecessary-type-assertion" 2
"../../src/libs/actions/OnyxDerived/index.ts" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/libs/actions/OnyxUpdateManager/index.ts" "@typescript-eslint/no-unsafe-type-assertion" 3
Expand Down Expand Up @@ -824,6 +823,7 @@
"../../src/libs/ComposerFocusManager.ts" "@typescript-eslint/no-deprecated/TextInput.State.currentlyFocusedField" 1
"../../src/libs/ComposerFocusManager.ts" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/libs/ComposerUtils/index.ts" "no-restricted-syntax" 1
"../../src/libs/computeReportAttributes.ts" "rulesdir/no-direct-personal-details-list" 2
"../../src/libs/CountryUtils.ts" "@typescript-eslint/no-unsafe-type-assertion" 2
"../../src/libs/CurrencyUtils.ts" "rulesdir/no-onyx-connect" 1
"../../src/libs/DateUtils.ts" "@typescript-eslint/no-unnecessary-type-assertion" 1
Expand Down Expand Up @@ -2511,7 +2511,7 @@
"../../tests/unit/OnyxDerived/visibleReportActionsTest.ts" "@typescript-eslint/no-unnecessary-type-assertion" 2
"../../tests/unit/onyxDerivedComputeSpanTest.ts" "@typescript-eslint/no-unnecessary-type-assertion" 1
"../../tests/unit/OnyxDerivedSelfHealTest.ts" "no-restricted-imports" 1
"../../tests/unit/OnyxDerivedTest.tsx" "@typescript-eslint/no-unnecessary-type-assertion" 3
"../../tests/unit/OnyxDerivedTest.tsx" "@typescript-eslint/no-unnecessary-type-assertion" 1
"../../tests/unit/OnyxDerivedTest.tsx" "no-restricted-imports" 1
"../../tests/unit/OptionsListUtilsTest.tsx" "@typescript-eslint/no-unnecessary-type-assertion" 14
"../../tests/unit/pages/DynamicReportDetailsPage/useReportDetailsDeleteModalTest.ts" "@typescript-eslint/no-deprecated/originalMessage" 1
Expand Down Expand Up @@ -2558,7 +2558,6 @@
"../../tests/unit/SearchActionsTest.ts" "@typescript-eslint/no-unnecessary-type-assertion" 5
"../../tests/unit/SearchAutocompleteListTest.tsx" "@typescript-eslint/no-deprecated/originalMessage" 3
"../../tests/unit/SearchAutocompleteListTest.tsx" "import/no-duplicates" 1
"../../tests/unit/SearchAutocompleteListTest.tsx" "no-restricted-imports" 1
"../../tests/unit/SearchEditMultipleUtilsTest.ts" "@typescript-eslint/no-deprecated/originalMessage" 1
"../../tests/unit/SequentialQueueTest.ts" "@typescript-eslint/no-unnecessary-type-assertion" 2
"../../tests/unit/showReportActionNotificationTest.ts" "@typescript-eslint/no-unnecessary-type-assertion" 3
Expand Down Expand Up @@ -2601,7 +2600,6 @@
"../../tests/unit/useTwoFactorAuthRouteTests.ts" "@typescript-eslint/no-unnecessary-type-assertion" 3
"../../tests/unit/ViolationFixParityTest.ts" "@typescript-eslint/no-unnecessary-type-assertion" 1
"../../tests/unit/WhisperContentMentionContextTest.tsx" "@typescript-eslint/no-unnecessary-type-assertion" 2
"../../tests/unit/WorkspacesSettingsUtilsTest.ts" "no-restricted-imports" 1
"../../tests/utils/collections/card.ts" "@typescript-eslint/no-unnecessary-type-assertion" 1
"../../tests/utils/createMock.ts" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../tests/utils/LHNTestUtils.tsx" "@typescript-eslint/no-unnecessary-type-assertion" 1
Expand Down
4 changes: 2 additions & 2 deletions oxlint.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -1087,9 +1087,9 @@ export default defineConfig({
{files: ['src/styles/**'], excludeFiles: ['src/styles/typography.ts', 'src/styles/variables.ts'], rules: {'rulesdir/no-raw-typography': ['error', {allowVariablesReferences: true}]}},
{files: ['**/en.ts', '**/es.ts'], rules: {'rulesdir/use-periods-for-error-messages': 'error'}},
{files: ['src/libs/ReportNameUtils.ts'], rules: {'report-name-utils/no-function-call-in-get-report-name': 'error'}},
// reportAttributes.ts computes report names, so the TypeScript-only bans do not apply.
// ReportAttributesComputeUtils.ts computes report names, so the TypeScript-only bans do not apply.
{
files: ['src/libs/actions/OnyxDerived/configs/reportAttributes.ts'],
files: ['src/libs/ReportAttributesComputeUtils.ts'],
rules: {'no-restricted-imports': ['error', {paths: restrictedImportPaths, patterns: restrictedImportPatterns}]},
},
{
Expand Down
11 changes: 9 additions & 2 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ const ONYXKEYS = {
/** Whether the app is currently loading a translation */
RAM_ONLY_ARE_TRANSLATIONS_LOADING: 'areTranslationsLoading',

/** The report attributes saved on idle, so the next app start doesn't have to compute them all before showing the LHN */
REPORT_ATTRIBUTES_SNAPSHOT: 'reportAttributesSnapshot',

/** Whether the user has tried focus mode yet */
NVP_TRY_FOCUS_MODE: 'nvp_tryFocusMode',

Expand Down Expand Up @@ -666,6 +669,9 @@ const ONYXKEYS = {
/** @deprecated Use ACTIVE_SERVER. */
SHOULD_USE_STAGING_SERVER: 'shouldUseStagingServer',

/** @deprecated The report attributes are computed through useOnyxState now. Only read by the RemoveReportAttributesDerivedValue migration. */
LEGACY_REPORT_ATTRIBUTES: 'reportAttributes',

/** Which server environment the app talks to */
ACTIVE_SERVER: 'activeServer',

Expand Down Expand Up @@ -1479,7 +1485,6 @@ const ONYXKEYS = {
BUSINESS_CENTRAL_CREDENTIALS_FORM_DRAFT: 'businessCentralCredentialsFormDraft',
},
DERIVED: {
REPORT_ATTRIBUTES: 'reportAttributes',
REPORT_TRANSACTIONS_AND_VIOLATIONS: 'reportTransactionsAndViolations',
OUTSTANDING_REPORTS_BY_POLICY_ID: 'outstandingReportsByPolicyID',
VISIBLE_REPORT_ACTIONS: 'visibleReportActions',
Expand Down Expand Up @@ -1853,6 +1858,7 @@ type OnyxValuesMapping = {
[ONYXKEYS.ONFIDO_APPLICANT_ID]: string;
[ONYXKEYS.NVP_PREFERRED_LOCALE]: OnyxTypes.Locale;
[ONYXKEYS.RAM_ONLY_ARE_TRANSLATIONS_LOADING]: boolean;
[ONYXKEYS.REPORT_ATTRIBUTES_SNAPSHOT]: OnyxTypes.ReportAttributesSnapshot;
[ONYXKEYS.NVP_ACTIVE_POLICY_ID]: string;
[ONYXKEYS.NVP_LAST_DISMISSED_MARKETING_WINDOW]: string;
[ONYXKEYS.NVP_DISMISSED_REFERRAL_BANNERS]: OnyxTypes.DismissedReferralBanners;
Expand Down Expand Up @@ -1963,6 +1969,8 @@ type OnyxValuesMapping = {
[ONYXKEYS.SHOULD_MASK_ONYX_STATE]: boolean;
// eslint-disable-next-line @typescript-eslint/no-deprecated -- the key stays typed while it is still read
[ONYXKEYS.SHOULD_USE_STAGING_SERVER]: boolean;
// eslint-disable-next-line @typescript-eslint/no-deprecated -- the key stays typed until the migration has removed it everywhere
[ONYXKEYS.LEGACY_REPORT_ATTRIBUTES]: OnyxTypes.ReportAttributesDerivedValue;
[ONYXKEYS.ACTIVE_SERVER]: ValueOf<typeof CONST.SERVER>;
[ONYXKEYS.CLOUDFLARE_SESSION]: OnyxTypes.CloudflareSession;
[ONYXKEYS.IS_DEBUG_MODE_ENABLED]: boolean;
Expand Down Expand Up @@ -2080,7 +2088,6 @@ type OnyxValuesMapping = {
};

type OnyxDerivedValuesMapping = {
[ONYXKEYS.DERIVED.REPORT_ATTRIBUTES]: OnyxTypes.ReportAttributesDerivedValue;
[ONYXKEYS.DERIVED.REPORT_TRANSACTIONS_AND_VIOLATIONS]: OnyxTypes.ReportTransactionsAndViolationsDerivedValue;
[ONYXKEYS.DERIVED.OUTSTANDING_REPORTS_BY_POLICY_ID]: OnyxTypes.OutstandingReportsByPolicyIDDerivedValue;
[ONYXKEYS.DERIVED.VISIBLE_REPORT_ACTIONS]: OnyxTypes.VisibleReportActionsDerivedValue;
Expand Down
4 changes: 2 additions & 2 deletions src/components/AvatarWithDisplayName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import {useAllPersonalDetails} from '@hooks/usePersonalDetails';
import usePolicy from '@hooks/usePolicy';
import {useDerivedReportNamesByReportIDs} from '@hooks/useReportAttributes';
import {useReportNames} from '@hooks/useReportAttributes';
import useReportIsArchived from '@hooks/useReportIsArchived';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
Expand Down Expand Up @@ -226,7 +226,7 @@ function AvatarWithDisplayName({
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {isSmallScreenWidth} = useResponsiveLayout();

const derivedReportNames = useDerivedReportNamesByReportIDs([report?.reportID, report?.parentReportID]);
const derivedReportNames = useReportNames([report?.reportID, report?.parentReportID]);
const isReportArchived = useReportIsArchived(report?.reportID);
const isParentReportArchived = useReportIsArchived(report?.parentReportID);
const icons = useMemoizedLazyExpensifyIcons(['Pencil']);
Expand Down
4 changes: 2 additions & 2 deletions src/components/LHNOptionsList/LHNTooltipContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import useOnyx from '@hooks/useOnyx';
import useReportAttributes from '@hooks/useReportAttributes';
import {useAllReportAttributes} from '@hooks/useReportAttributes';
import useRootNavigationState from '@hooks/useRootNavigationState';

import NAVIGATORS from '@src/NAVIGATORS';
Expand All @@ -24,7 +24,7 @@ function LHNTooltipContextProvider({data, children}: LHNTooltipContextProviderPr
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [onboarding] = useOnyx(ONYXKEYS.NVP_ONBOARDING);
const [isFullscreenVisible] = useOnyx(ONYXKEYS.FULLSCREEN_VISIBILITY);
const reportAttributes = useReportAttributes();
const reportAttributes = useAllReportAttributes();

const firstReportIDWithGBRorRBR = data.find((reportID) => {
const attrs = reportAttributes?.[reportID];
Expand Down
11 changes: 4 additions & 7 deletions src/components/LHNOptionsList/OptionRowLHN/OptionRowLHNData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import usePersonalDetailByLogin from '@hooks/usePersonalDetailByLogin';
import {usePersonalDetailsByIDs} from '@hooks/usePersonalDetails';
import {useReportAttributesByID} from '@hooks/useReportAttributes';
import {useReportAttributesEntry, useReportNameEntries} from '@hooks/useReportAttributes';

import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
import {
Expand All @@ -31,13 +31,12 @@ import CONST from '@src/CONST';
import {getMovedReportID} from '@src/libs/ModifiedExpenseMessage';
import ONYXKEYS from '@src/ONYXKEYS';
import type {PersonalDetailsList, Report, ReportAction, ReportActions as ReportActionsType} from '@src/types/onyx';
import type {ReportAttributesDerivedValue, VisibleReportActionsDerivedValue} from '@src/types/onyx/DerivedValues';
import type {VisibleReportActionsDerivedValue} from '@src/types/onyx/DerivedValues';

import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';

import {isTrackIntentUserSelector} from '@selectors/Onboarding';
import {accountIDSelector} from '@selectors/PersonalDetails';
import {reportNamesByIDsSelector} from '@selectors/ReportAttributes';
import {optionRowReportMetadataSelector} from '@selectors/ReportMetaData';
import React from 'react';

Expand Down Expand Up @@ -126,7 +125,7 @@ function OptionRowLHNData({isOptionFocused = false, viewMode = 'default', report
const {login, accountID: currentUserAccountID} = useCurrentUserPersonalDetails();

const [fullReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
const reportAttributes = useReportAttributesByID(reportID);
const reportAttributes = useReportAttributesEntry(reportID);
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`);
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${reportID}`);
const [draftComment] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${reportID}`);
Expand Down Expand Up @@ -205,9 +204,7 @@ function OptionRowLHNData({isOptionFocused = false, viewMode = 'default', report
const [lastActionReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(lastActionReportID ? String(lastActionReportID) : undefined)}`);
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 [reportNames] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {
selector: (attributes: OnyxEntry<ReportAttributesDerivedValue>) => reportNamesByIDsSelector(attributes, reportNameIDs),
});
const reportNames = useReportNameEntries(reportNameIDs);
const [personalDetails] = usePersonalDetailsByIDs(
getOptionRowAccountIDs({
report: fullReport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import MenuItemFieldHTML from '@components/MenuItem/presets/MenuItemFieldHTML';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useOutstandingReports from '@hooks/useOutstandingReports';
import {useDerivedReportNameByReportID} from '@hooks/useReportAttributes';
import {useReportName} from '@hooks/useReportAttributes';

import createDynamicRoute from '@libs/Navigation/helpers/dynamicRoutesUtils/createDynamicRoute';
import Navigation from '@libs/Navigation/Navigation';
Expand Down Expand Up @@ -100,7 +100,7 @@ function ReportField({selectedParticipants, iouType, reportID, reportActionID, a
return [reportIDToUse, reportToUse ?? undefined] as const;
})();

const derivedReportName = useDerivedReportNameByReportID(selectedReportID);
const derivedReportName = useReportName(selectedReportID);

const reportName = (() => {
const name = getReportName(selectedReport, derivedReportName);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Navigation/DebugTabView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useIndicatorStatus from '@hooks/useIndicatorStatus';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useReportAttributes from '@hooks/useReportAttributes';
import {useAllReportAttributes} from '@hooks/useReportAttributes';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useRootNavigationState from '@hooks/useRootNavigationState';
import {useSidebarOrderedReportsState} from '@hooks/useSidebarOrderedReports';
Expand Down Expand Up @@ -162,7 +162,7 @@ function DebugTabView({selectedTab}: Props) {
const {windowWidth} = useWindowDimensions();
const sidePanelOffset = isExtraLargeScreenWidth && !shouldHideSidePanel ? variables.sidePanelWidth : 0;
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT);
const reportAttributes = useReportAttributes();
const reportAttributes = useAllReportAttributes();
const {status, indicatorColor, indicatorPolicyID} = useIndicatorStatus();
const {orderedReportIDs, chatTabBrickRoad} = useSidebarOrderedReportsState();
const icons = useMemoizedLazyExpensifyIcons(['DotIndicator']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Text from '@components/Text';

import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import {useReportName} from '@hooks/useReportAttributes';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
Expand All @@ -17,12 +17,7 @@ import {getReportStatusColorStyle, getReportStatusTooltipTranslation, getReportS
import variables from '@styles/variables';

import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ReportAttributesDerivedValue} from '@src/types/onyx';

import type {OnyxEntry} from 'react-native-onyx';

import {reportNameSelector} from '@selectors/ReportAttributes';
import React from 'react';
import {View} from 'react-native';
import Animated from 'react-native-reanimated';
Expand All @@ -45,8 +40,7 @@ function ReportPreviewHeader() {
const {goToPrevious, goToNext} = useReportPreviewActions();
const numberOfRequests = transactions.length;

const selectReportName = (attributes: OnyxEntry<ReportAttributesDerivedValue>) => reportNameSelector(attributes, iouReportID);
const [derivedReportName] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {selector: selectReportName});
const derivedReportName = useReportName(iouReportID);
const reportName = derivedReportName ?? iouReport?.reportName ?? '';
const formattedReportName = Parser.htmlToText(reportName || (action.childReportName ?? ''));

Expand Down
4 changes: 2 additions & 2 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import usePermissions from '@hooks/usePermissions';
import {usePersonalDetail} from '@hooks/usePersonalDetails';
import usePersonalPolicy from '@hooks/usePersonalPolicy';
import usePolicyForMovingExpenses from '@hooks/usePolicyForMovingExpenses';
import {useDerivedReportNamesByReportIDs} from '@hooks/useReportAttributes';
import {useReportNames} from '@hooks/useReportAttributes';
import useReportIsArchived from '@hooks/useReportIsArchived';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useRestrictedActionPolicyID from '@hooks/useRestrictedActionPolicyID';
Expand Down Expand Up @@ -612,7 +612,7 @@ function MoneyRequestView({
const tripID = tripRoomReportNameValuePairs?.tripData?.tripID;
const shouldShowViewTripDetails = hasReservationList(transaction) && !!tripID;

const derivedReportNames = useDerivedReportNamesByReportIDs([tripRoomReportID, parentReport?.reportID]);
const derivedReportNames = useReportNames([tripRoomReportID, parentReport?.reportID]);

const tripRoomDerivedName = tripRoomReportID ? derivedReportNames?.[tripRoomReportID] : undefined;
const tripRoomName = tripRoomReport ? getReportName(tripRoomReport, tripRoomDerivedName) : undefined;
Expand Down
Loading
Loading