diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx index a50c26142ada..6963cca5807a 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx @@ -1,7 +1,7 @@ import LinkButton from '@components/Button/composed/LinkButton'; import type FlatListRefType from '@components/FlashList/types'; import {useSearchSelectionActions, useSearchSelectionContext} from '@components/Search/SearchContext'; -import type {SearchCustomColumnIds, SortOrder} from '@components/Search/types'; +import type {SortOrder} from '@components/Search/types'; import useCopySelectionHelper from '@hooks/useCopySelectionHelper'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; @@ -12,19 +12,14 @@ import useMobileSelectionMode from '@hooks/useMobileSelectionMode'; import useNavigateToTransactionThread from '@hooks/useNavigateToTransactionThread'; import useNetwork from '@hooks/useNetwork'; import useOnyx from '@hooks/useOnyx'; -import usePermissions from '@hooks/usePermissions'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useResponsiveLayoutOnWideRHP from '@hooks/useResponsiveLayoutOnWideRHP'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import useWindowDimensions from '@hooks/useWindowDimensions'; -import {getReportLayoutGroupBy, getReportLayoutSelection, setReportLayout} from '@libs/actions/ReportLayout'; import {clearActiveTransactionIDs, getActiveTransactionIDs, setActiveTransactionIDs} from '@libs/actions/TransactionThreadNavigation'; import {resolveTransactionCardFields} from '@libs/CardUtils'; -import {isBillableEnabledOnPolicy} from '@libs/MoneyRequestReportUtils'; import {navigationRef} from '@libs/Navigation/Navigation'; -import {hasVendorFeature, isPolicyTaxEnabled} from '@libs/PolicyUtils'; import {getOriginalMessage, isMoneyRequestAction} from '@libs/ReportActionsUtils'; import {groupTransactionsByCategory, groupTransactionsByTag} from '@libs/ReportLayoutUtils'; import { @@ -37,12 +32,10 @@ import { isSortableColumnName, } from '@libs/ReportUtils'; import type {SortableColumnName} from '@libs/ReportUtils'; -import {compareValues, getColumnsToShow, getTableMinWidth, isTransactionAmountTooLong, isTransactionTaxAmountTooLong} from '@libs/SearchUIUtils'; +import {compareValues} from '@libs/SearchUIUtils'; import {getPendingSubmitFollowUpAction} from '@libs/telemetry/submitFollowUpAction'; import {transactionHasRBR} from '@libs/TransactionPreviewUtils'; -import {getTransactionPendingAction, getVisibleTransactionViolations, hasNonReimbursableTransactions, isTransactionPendingDelete} from '@libs/TransactionUtils'; -import shouldShowTransactionPostedYear from '@libs/TransactionUtils/shouldShowTransactionPostedYear'; -import shouldShowTransactionYear from '@libs/TransactionUtils/shouldShowTransactionYear'; +import {getTransactionPendingAction, getVisibleTransactionViolations, isTransactionPendingDelete} from '@libs/TransactionUtils'; import isReportOpenInSuperWideRHP from '@navigation/helpers/isReportOpenInSuperWideRHP'; import Navigation from '@navigation/Navigation'; @@ -75,6 +68,8 @@ import MoneyRequestReportTransactionItem from './MoneyRequestReportTransactionIt import MoneyRequestReportTransactionLongPressModal from './MoneyRequestReportTransactionLongPressModal'; import MoneyRequestReportUnifiedList from './MoneyRequestReportUnifiedList'; import SearchMoneyRequestReportEmptyState from './SearchMoneyRequestReportEmptyState'; +import useMoneyRequestReportColumns from './useMoneyRequestReportColumns'; +import useMoneyRequestReportLayout from './useMoneyRequestReportLayout'; type TransactionWithOptionalHighlight = OnyxTypes.Transaction & { /** Whether the transaction should be highlighted, when it is added to the report */ @@ -270,17 +265,11 @@ function MoneyRequestReportTransactionList({ const longPressModalRef = useRef(null); const {reportPendingAction} = getReportOfflinePendingActionAndErrors(report); const {isOffline} = useNetwork(); - const {isBetaEnabled} = usePermissions(); - const isTaxEnabled = isPolicyTaxEnabled(policy); const {totalDisplaySpend} = getMoneyRequestSpendBreakdown(report); - const shouldShowExpenseReportBreakDown = hasNonReimbursableTransactions(transactions); const currentUserDetails = useCurrentUserPersonalDetails(); const ownerLoginSelector = useMemo(() => personalDetailsLoginSelector(report?.ownerAccountID), [report?.ownerAccountID]); const [ownerLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: ownerLoginSelector}); - const [reportLayoutGroupBy] = useOnyx(ONYXKEYS.NVP_REPORT_LAYOUT_GROUP_BY); - const [reportLayoutOption] = useOnyx(ONYXKEYS.NVP_REPORT_LAYOUT_OPTION); - const [reportDetailsColumns] = useOnyx(ONYXKEYS.NVP_REPORT_DETAILS_COLUMNS); const [nonPersonalAndWorkspaceCards] = useOnyx(ONYXKEYS.DERIVED.NON_PERSONAL_AND_WORKSPACE_CARD_LIST); const [cardList] = useOnyx(ONYXKEYS.CARD_LIST); const [allTransactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); @@ -444,62 +433,10 @@ function MoneyRequestReportTransactionList({ const highlightedTransactionIDs = useMemo(() => new Set(newTransactions.map(({transactionID}) => transactionID)), [newTransactions]); - // Always use default columns for money request report view (don't use user-customized search columns) - const isExpenseReportViewFromIOUReport = isIOUReport(report); - const shouldShowBillableColumn = isBillableEnabledOnPolicy(policy); - const shouldShowCommentsColumn = useMemo(() => Object.values(reportActions ?? {}).some((action) => (action?.childVisibleActionCount ?? 0) > 0), [reportActions]); - // The saved column list is account-wide, so drop the vendor column on reports whose workspace lacks the vendor feature. - const isVendorColumnAvailable = hasVendorFeature(policy, isBetaEnabled(CONST.BETAS.VENDOR_MATCHING)); - const columnsToShow = useMemo(() => { - const savedColumns = (reportDetailsColumns ?? []).filter((column) => isVendorColumnAvailable || column !== CONST.SEARCH.TABLE_COLUMNS.VENDOR); - return getColumnsToShow({ - currentAccountID: currentUserDetails?.accountID, - data: transactions, - report, - visibleColumns: (isExpenseReportViewFromIOUReport ? [] : savedColumns) as SearchCustomColumnIds[], - isExpenseReportView: true, - isExpenseReportViewFromIOUReport, - shouldShowBillableColumn, - shouldShowCommentsColumn, - shouldShowReimbursableColumn: shouldShowExpenseReportBreakDown, - reportCurrency: report?.currency, - isPolicyTaxEnabled: isTaxEnabled, - }); - }, [ - transactions, - currentUserDetails?.accountID, - isExpenseReportViewFromIOUReport, - shouldShowBillableColumn, - shouldShowCommentsColumn, - reportDetailsColumns, - isVendorColumnAvailable, - report, - isTaxEnabled, - shouldShowExpenseReportBreakDown, - ]); - - const {windowWidth} = useWindowDimensions(); - const minTableWidth = getTableMinWidth(columnsToShow); - const shouldScrollHorizontally = !shouldUseNarrowLayout && minTableWidth > windowWidth; - - // Latch the user's most recent selection so the popover label and grouping mode never flick through the - // (layoutOption=null, groupByOption=null) → CATEGORY default while the two NVPs settle in separate render passes. - // Drop the latch once Onyx reaches the clicked value, so later authoritative updates (failureData rollback, - // another client changing the layout) flow through instead of staying masked by stale local state. - const [pendingLayoutSelection, setPendingLayoutSelection] = useState(null); - const onyxLayoutSelection = getReportLayoutSelection(reportLayoutOption, reportLayoutGroupBy); - const currentSelection: OnyxTypes.ReportLayoutSelection = pendingLayoutSelection ?? onyxLayoutSelection; - useEffect(() => { - if (pendingLayoutSelection === null || pendingLayoutSelection !== onyxLayoutSelection) { - return; - } - // eslint-disable-next-line react-hooks/set-state-in-effect -- syncs the click latch to Onyx so subsequent authoritative updates aren't masked by stale local state - setPendingLayoutSelection(null); - }, [pendingLayoutSelection, onyxLayoutSelection]); + const {columnsToShow, dateColumnSize, postedColumnSize, amountColumnSize, taxAmountColumnSize, minTableWidth, shouldScrollHorizontally, isExpenseReportViewFromIOUReport} = + useMoneyRequestReportColumns({report, policy, transactions, reportActions}); - const isLayoutMatrixSelected = currentSelection === CONST.REPORT_LAYOUT.LAYOUT_OPTION.MATRIX; - const currentGroupBy: OnyxTypes.ReportLayoutGroupBy = currentSelection !== CONST.REPORT_LAYOUT.LAYOUT_OPTION.MATRIX ? currentSelection : getReportLayoutGroupBy(reportLayoutGroupBy); - const shouldGroupTransactions = shouldShowGroupedTransactions && !isLayoutMatrixSelected; + const {currentSelection, currentGroupBy, shouldGroupTransactions, selectLayout} = useMoneyRequestReportLayout(shouldShowGroupedTransactions); const groupedTransactions = useMemo(() => { if (!shouldGroupTransactions) { @@ -616,19 +553,6 @@ function MoneyRequestReportTransactionList({ [navigateToTransactionThread, reportActions, sortedTransactions, report, visualOrderTransactionIDs], ); - const {amountColumnSize, dateColumnSize, postedColumnSize, taxAmountColumnSize} = useMemo(() => { - const isAmountColumnWide = transactions.some((transaction) => isTransactionAmountTooLong(transaction)); - const isTaxAmountColumnWide = transactions.some((transaction) => isTransactionTaxAmountTooLong(transaction)); - const shouldShowYearForSomeTransaction = transactions.some((transaction) => shouldShowTransactionYear(transaction)); - const shouldShowPostedYearForSomeTransaction = transactions.some((transaction) => shouldShowTransactionPostedYear(transaction)); - return { - amountColumnSize: isAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, - taxAmountColumnSize: isTaxAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, - dateColumnSize: shouldShowYearForSomeTransaction ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, - postedColumnSize: shouldShowPostedYearForSomeTransaction ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, - }; - }, [transactions]); - const isEmptyTransactions = isEmpty(transactions); const handleLongPress = useCallback( @@ -786,10 +710,7 @@ function MoneyRequestReportTransactionList({ {shouldShowGroupedTransactions && ( { - setPendingLayoutSelection(selection); - setReportLayout(selection, reportLayoutOption, reportLayoutGroupBy); - }} + onSelect={selectLayout} /> )} {!shouldUseNarrowLayout && !isExpenseReportViewFromIOUReport && ( diff --git a/src/components/MoneyRequestReportView/useMoneyRequestReportColumns.ts b/src/components/MoneyRequestReportView/useMoneyRequestReportColumns.ts new file mode 100644 index 000000000000..e186d9dd03db --- /dev/null +++ b/src/components/MoneyRequestReportView/useMoneyRequestReportColumns.ts @@ -0,0 +1,114 @@ +import type {SearchColumnType, TableColumnSize} from '@components/Search/types'; + +import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; +import useOnyx from '@hooks/useOnyx'; +import usePermissions from '@hooks/usePermissions'; +import useResponsiveLayoutOnWideRHP from '@hooks/useResponsiveLayoutOnWideRHP'; +import useWindowDimensions from '@hooks/useWindowDimensions'; + +import {isBillableEnabledOnPolicy} from '@libs/MoneyRequestReportUtils'; +import {hasVendorFeature, isPolicyTaxEnabled} from '@libs/PolicyUtils'; +import {isIOUReport} from '@libs/ReportUtils'; +import {getColumnsToShow, getTableMinWidth, isReportDetailsCustomColumn, isTransactionAmountTooLong, isTransactionTaxAmountTooLong} from '@libs/SearchUIUtils'; +import {hasNonReimbursableTransactions} from '@libs/TransactionUtils'; +import shouldShowTransactionPostedYear from '@libs/TransactionUtils/shouldShowTransactionPostedYear'; +import shouldShowTransactionYear from '@libs/TransactionUtils/shouldShowTransactionYear'; + +import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; +import type {StableReport} from '@src/selectors/Report'; +import type * as OnyxTypes from '@src/types/onyx'; + +type UseMoneyRequestReportColumnsParams = { + /** The money request report containing the transactions */ + report: StableReport; + + /** The workspace to which the report belongs */ + policy: OnyxTypes.Policy | undefined; + + /** List of transactions belonging to one report */ + transactions: OnyxTypes.Transaction[]; + + /** Report actions of the report, used to decide whether the comments column shows */ + reportActions: OnyxTypes.ReportAction[]; +}; + +type UseMoneyRequestReportColumnsResult = { + /** The columns the table renders, in order */ + columnsToShow: SearchColumnType[]; + + /** Width bucket of the date column */ + dateColumnSize: TableColumnSize; + + /** Width bucket of the posted-date column */ + postedColumnSize: TableColumnSize; + + /** Width bucket of the amount column */ + amountColumnSize: TableColumnSize; + + /** Width bucket of the tax-amount column */ + taxAmountColumnSize: TableColumnSize; + + /** Pixel width of the table at full column visibility */ + minTableWidth: number; + + /** True when the rendered table is wider than the viewport and needs its own horizontal scroller */ + shouldScrollHorizontally: boolean; + + /** True when opened from an IOU report, which hides column customization */ + isExpenseReportViewFromIOUReport: boolean; +}; + +/** + * Derives which columns the transaction table shows and how wide they are, from the report's + * transactions and the user's saved column preferences. + */ +function useMoneyRequestReportColumns({report, policy, transactions, reportActions}: UseMoneyRequestReportColumnsParams): UseMoneyRequestReportColumnsResult { + const currentUserDetails = useCurrentUserPersonalDetails(); + const [reportDetailsColumns] = useOnyx(ONYXKEYS.NVP_REPORT_DETAILS_COLUMNS); + const {windowWidth} = useWindowDimensions(); + const {shouldUseNarrowLayout} = useResponsiveLayoutOnWideRHP(); + const {isBetaEnabled} = usePermissions(); + + // Always use default columns for money request report view (don't use user-customized search columns) + const isExpenseReportViewFromIOUReport = isIOUReport(report); + const shouldShowBillableColumn = isBillableEnabledOnPolicy(policy); + const shouldShowCommentsColumn = Object.values(reportActions ?? {}).some((action) => (action?.childVisibleActionCount ?? 0) > 0); + // The saved column list is account-wide, so drop the vendor column on reports whose workspace lacks the vendor feature. + const isVendorColumnAvailable = hasVendorFeature(policy, isBetaEnabled(CONST.BETAS.VENDOR_MATCHING)); + const savedColumns = (reportDetailsColumns ?? []).filter(isReportDetailsCustomColumn).filter((column) => isVendorColumnAvailable || column !== CONST.SEARCH.TABLE_COLUMNS.VENDOR); + const columnsToShow = getColumnsToShow({ + currentAccountID: currentUserDetails?.accountID, + data: transactions, + report, + visibleColumns: isExpenseReportViewFromIOUReport ? [] : savedColumns, + isExpenseReportView: true, + isExpenseReportViewFromIOUReport, + shouldShowBillableColumn, + shouldShowCommentsColumn, + shouldShowReimbursableColumn: hasNonReimbursableTransactions(transactions), + reportCurrency: report?.currency, + isPolicyTaxEnabled: isPolicyTaxEnabled(policy), + }); + + const isAmountColumnWide = transactions.some((transaction) => isTransactionAmountTooLong(transaction)); + const isTaxAmountColumnWide = transactions.some((transaction) => isTransactionTaxAmountTooLong(transaction)); + const shouldShowYearForSomeTransaction = transactions.some((transaction) => shouldShowTransactionYear(transaction)); + const shouldShowPostedYearForSomeTransaction = transactions.some((transaction) => shouldShowTransactionPostedYear(transaction)); + + const minTableWidth = getTableMinWidth(columnsToShow); + const shouldScrollHorizontally = !shouldUseNarrowLayout && minTableWidth > windowWidth; + + return { + columnsToShow, + dateColumnSize: shouldShowYearForSomeTransaction ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, + postedColumnSize: shouldShowPostedYearForSomeTransaction ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, + amountColumnSize: isAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, + taxAmountColumnSize: isTaxAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL, + minTableWidth, + shouldScrollHorizontally, + isExpenseReportViewFromIOUReport, + }; +} + +export default useMoneyRequestReportColumns; diff --git a/src/components/MoneyRequestReportView/useMoneyRequestReportLayout.ts b/src/components/MoneyRequestReportView/useMoneyRequestReportLayout.ts new file mode 100644 index 000000000000..665473db72d1 --- /dev/null +++ b/src/components/MoneyRequestReportView/useMoneyRequestReportLayout.ts @@ -0,0 +1,66 @@ +import useOnyx from '@hooks/useOnyx'; + +import {getReportLayoutGroupBy, getReportLayoutSelection, setReportLayout} from '@libs/actions/ReportLayout'; + +import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; +import type * as OnyxTypes from '@src/types/onyx'; + +import {useEffect, useState} from 'react'; + +type UseMoneyRequestReportLayoutResult = { + /** The layout selection currently shown to the user (latched click or the Onyx value) */ + currentSelection: OnyxTypes.ReportLayoutSelection; + + /** The attribute transactions are grouped by while grouping is on */ + currentGroupBy: OnyxTypes.ReportLayoutGroupBy; + + /** Whether the transactions should be rendered in groups */ + shouldGroupTransactions: boolean; + + /** Persists a layout selection and latches it locally until Onyx settles */ + selectLayout: (selection: OnyxTypes.ReportLayoutSelection) => void; +}; + +/** + * Owns the report-layout (group-by) selection: reads the two NVPs, exposes the effective selection and + * grouping mode, and persists user picks. + * + * Latches the last clicked selection so the label and grouping never flicker through the CATEGORY default while + * the two NVPs settle in separate render passes. Drops the latch once Onyx reaches that value, so rollbacks and + * updates from other clients flow through. + */ +function useMoneyRequestReportLayout(shouldShowGroupedTransactions: boolean): UseMoneyRequestReportLayoutResult { + const [reportLayoutGroupBy] = useOnyx(ONYXKEYS.NVP_REPORT_LAYOUT_GROUP_BY); + const [reportLayoutOption] = useOnyx(ONYXKEYS.NVP_REPORT_LAYOUT_OPTION); + const [pendingLayoutSelection, setPendingLayoutSelection] = useState(null); + + const onyxLayoutSelection = getReportLayoutSelection(reportLayoutOption, reportLayoutGroupBy); + const currentSelection: OnyxTypes.ReportLayoutSelection = pendingLayoutSelection ?? onyxLayoutSelection; + + useEffect(() => { + if (pendingLayoutSelection === null || pendingLayoutSelection !== onyxLayoutSelection) { + return; + } + // eslint-disable-next-line react-hooks/set-state-in-effect -- syncs the click latch to Onyx so subsequent authoritative updates aren't masked by stale local state + setPendingLayoutSelection(null); + }, [pendingLayoutSelection, onyxLayoutSelection]); + + const isLayoutMatrixSelected = currentSelection === CONST.REPORT_LAYOUT.LAYOUT_OPTION.MATRIX; + const currentGroupBy: OnyxTypes.ReportLayoutGroupBy = currentSelection !== CONST.REPORT_LAYOUT.LAYOUT_OPTION.MATRIX ? currentSelection : getReportLayoutGroupBy(reportLayoutGroupBy); + const shouldGroupTransactions = shouldShowGroupedTransactions && !isLayoutMatrixSelected; + + const selectLayout = (selection: OnyxTypes.ReportLayoutSelection) => { + setPendingLayoutSelection(selection); + setReportLayout(selection, reportLayoutOption, reportLayoutGroupBy); + }; + + return { + currentSelection, + currentGroupBy, + shouldGroupTransactions, + selectLayout, + }; +} + +export default useMoneyRequestReportLayout; diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 233d69ed761f..60420c7e9e1c 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -4285,6 +4285,10 @@ function insertColumnBeforeTotalAmount(columns: T[], columns.splice(totalAmountIndex, 0, columnId); } +function isReportDetailsCustomColumn(column: string): column is SearchCustomColumnIds { + return Object.values(CONST.SEARCH.REPORT_DETAILS_CUSTOM_COLUMNS).some((customColumn) => customColumn === column); +} + function getCustomColumns(value?: SearchDataTypes | SearchGroupBy): SearchCustomColumnIds[] { switch (value) { case CONST.SEARCH.DATA_TYPES.EXPENSE: @@ -7247,6 +7251,7 @@ export { getWithdrawalStatusOptions, getWithdrawalStatusDisplayText, getColumnsToShow, + isReportDetailsCustomColumn, insertColumnBeforeTotalAmount, getHasOptions, getSubmittedViolationsForTransaction, diff --git a/src/pages/settings/Report/ReportDetailsColumnsPage.tsx b/src/pages/settings/Report/ReportDetailsColumnsPage.tsx index 2428e21379e2..44cc662cf3b1 100644 --- a/src/pages/settings/Report/ReportDetailsColumnsPage.tsx +++ b/src/pages/settings/Report/ReportDetailsColumnsPage.tsx @@ -11,7 +11,7 @@ import Navigation from '@libs/Navigation/Navigation'; import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; import {hasVendorFeature, isPolicyTaxEnabled} from '@libs/PolicyUtils'; import {isIOUReport} from '@libs/ReportUtils'; -import {getColumnsToShow} from '@libs/SearchUIUtils'; +import {getColumnsToShow, isReportDetailsCustomColumn} from '@libs/SearchUIUtils'; import {hasNonReimbursableTransactions} from '@libs/TransactionUtils'; import type {ReportSettingsNavigatorParamList} from '@navigation/types'; @@ -41,13 +41,7 @@ const REPORT_DETAILS_DEFAULT_COLUMNS: SearchCustomColumnIds[] = [ CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT, ]; -const REPORT_DETAILS_CUSTOM_COLUMNS = Object.values(CONST.SEARCH.REPORT_DETAILS_CUSTOM_COLUMNS); - -function isReportDetailsCustomColumn(column: string): column is SearchCustomColumnIds { - return REPORT_DETAILS_CUSTOM_COLUMNS.some((customColumn) => customColumn === column); -} - -const ALL_REPORT_DETAILS_CUSTOM_COLUMNS = REPORT_DETAILS_CUSTOM_COLUMNS.filter(isReportDetailsCustomColumn); +const ALL_REPORT_DETAILS_CUSTOM_COLUMNS = Object.values(CONST.SEARCH.REPORT_DETAILS_CUSTOM_COLUMNS).filter(isReportDetailsCustomColumn); function ReportDetailsColumnsPage() { const route = useRoute>();