Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
c2de4e4
Update outstanding report filters
ShridharGoel Jan 17, 2026
df6513b
Thread archived checks through edit gating
ShridharGoel Jan 17, 2026
cf65086
Use archived report checks in search selection
ShridharGoel Jan 17, 2026
4fefcb9
Refactor ReportUtils archive checks
ShridharGoel Jan 17, 2026
63f4056
Prettier fixes
ShridharGoel Jan 18, 2026
b3a1b98
Fix a duplicate declaration
ShridharGoel Jan 18, 2026
1d3bfbb
Updates
ShridharGoel Feb 21, 2026
d8d79fb
Merge main
ShridharGoel Feb 21, 2026
11d888a
Change Id to ID
ShridharGoel Feb 21, 2026
e3e932f
Change Id to ID
ShridharGoel Feb 21, 2026
4564e7a
Change useArchivedReportsIdSet to useArchivedReportsIDSet
ShridharGoel Feb 21, 2026
75c47f3
Merge main
ShridharGoel Feb 21, 2026
335ad6a
Fix
ShridharGoel Feb 21, 2026
a0465bf
Lint and prettier fixes
ShridharGoel Feb 21, 2026
fe0a427
Update more usages to pass the ID-set
ShridharGoel Feb 22, 2026
9806560
Update
ShridharGoel Feb 22, 2026
b8c565d
Merge branch 'main' of https://github.com/Expensify/App into onyxConn…
ShridharGoel Feb 22, 2026
b6abb3d
Update
ShridharGoel Feb 22, 2026
8409bcc
Address bot's consistency comment
ShridharGoel Feb 22, 2026
889ffdd
Address the codex comment
ShridharGoel Feb 22, 2026
5a740d9
Address the codex comment
ShridharGoel Feb 22, 2026
a0fbcca
Pass isReportArchivedByID to canEditMoneyRequest when finding canEdit
ShridharGoel Feb 22, 2026
6a75e62
Improvements
ShridharGoel Feb 22, 2026
3f540d5
Prettier fixes
ShridharGoel Feb 23, 2026
35faaf1
Merge main
ShridharGoel Feb 28, 2026
c30f218
Merge branch 'main' of https://github.com/Expensify/App into onyxConn…
ShridharGoel Feb 28, 2026
c1ba85b
Prettier and lint fixes
ShridharGoel Feb 28, 2026
f491807
Use set instead of function
ShridharGoel Feb 28, 2026
4be2146
Update test
ShridharGoel Feb 28, 2026
244e795
Use useMemo
ShridharGoel Feb 28, 2026
bece789
Update deep link handler
ShridharGoel Feb 28, 2026
a90cf63
Update money request archive prop to pass archived report set
ShridharGoel Mar 7, 2026
17b73eb
Merge main
ShridharGoel Mar 7, 2026
8779eb8
revert extra change in Permissions.ts
ShridharGoel Mar 7, 2026
5e034c1
Test fixes
ShridharGoel Mar 7, 2026
c41af72
Updates
ShridharGoel Mar 21, 2026
d7e9b8e
Merge main
ShridharGoel Mar 21, 2026
fbcdb49
Lint and TS fixes
ShridharGoel Mar 21, 2026
6e1041d
remove the now unused Onyx.connect field
ShridharGoel Mar 21, 2026
0610b57
Fixes
ShridharGoel Mar 21, 2026
f78046c
Address codex comment
ShridharGoel Mar 21, 2026
78ec659
Lint and prettier fixes
ShridharGoel Mar 21, 2026
c61b18f
Lint and prettier fixes
ShridharGoel Mar 21, 2026
e383c27
Update tests
ShridharGoel Mar 21, 2026
ba54186
Simplify archived report checks with ArchivedReportsIDSet
ShridharGoel Mar 31, 2026
6fb403d
Merge main
ShridharGoel Mar 31, 2026
cda6294
Fix
ShridharGoel Mar 31, 2026
a5daaca
Fixes
ShridharGoel Apr 1, 2026
4b920a6
Resolve archived report set merge conflicts
ShridharGoel Apr 1, 2026
7d04345
Resolve archived report set regressions and merge conflicts
ShridharGoel Apr 1, 2026
33d6162
Remove unused variables import from MoneyReportHeader
ShridharGoel Apr 1, 2026
3e028d5
Merge upstream/main into onyxConnect2.2
ShridharGoel Apr 2, 2026
dbf7771
Fix unused ExportType import
ShridharGoel Apr 2, 2026
298e045
Remove unrelated archive changes
ShridharGoel Apr 10, 2026
95f5275
Merge upstream/main
ShridharGoel Apr 10, 2026
e57314c
Fix ReportUtils optional params
ShridharGoel Apr 10, 2026
3a8d51f
Updates
ShridharGoel Apr 10, 2026
5622a62
Pass archived report set via props
ShridharGoel Apr 10, 2026
5f2c0d2
Fix archived report set test props
ShridharGoel Apr 11, 2026
7dc6970
Resolve merge conflicts
ShridharGoel Apr 30, 2026
0802cc8
Address PR review comments
ShridharGoel Apr 30, 2026
de378f7
Normalize archived reports hook naming
ShridharGoel Apr 30, 2026
386c9a7
Tighten archived report set parameters
ShridharGoel Apr 30, 2026
87c02a7
Revert "Tighten archived report set parameters"
ShridharGoel Apr 30, 2026
594479b
Revert "Normalize archived reports hook naming"
ShridharGoel Apr 30, 2026
5cdfc1f
Revert "Address PR review comments"
ShridharGoel Apr 30, 2026
1dd67f5
Narrow archived report connect removal
ShridharGoel Apr 30, 2026
58d528f
Restore full archived report migration
ShridharGoel Apr 30, 2026
2c03fef
Remove unused archived report prop plumbing
ShridharGoel Apr 30, 2026
9e6af31
Fix TS
ShridharGoel Apr 30, 2026
f991876
Fixes
ShridharGoel Apr 30, 2026
d96b37a
Merge branch 'main' of https://github.com/Expensify/App into onyxConn…
ShridharGoel May 8, 2026
a71b129
Split archived report UI plumbing into follow-up branch
ShridharGoel May 8, 2026
618e1b5
Fix transaction thread secondary actions call
ShridharGoel May 8, 2026
cd25ffa
Fix nullish fallback lint in report utils
ShridharGoel May 9, 2026
09b1e1b
Fix lint
ShridharGoel May 11, 2026
616e966
Address archived report review feedback
ShridharGoel May 14, 2026
1092af7
Merge branch 'main' of https://github.com/Expensify/App into onyxConn…
ShridharGoel May 15, 2026
cfdf13b
Pass archived report set to transaction actions
ShridharGoel May 21, 2026
95bae90
Merge branch 'main' of https://github.com/Expensify/App into onyxConn…
ShridharGoel May 21, 2026
21d18ae
Fix transaction action test call signature
ShridharGoel May 21, 2026
bbbe870
Remove unused onboarding beta subscriptions
ShridharGoel May 22, 2026
c474187
Clarify outstanding reports archived check
ShridharGoel May 26, 2026
c152cd4
Merge branch 'main' of https://github.com/Expensify/App into onyxConn…
ShridharGoel May 26, 2026
6252bdc
Fix archived reports hook import
ShridharGoel May 26, 2026
e4695b1
Address archived reports review feedback
ShridharGoel May 27, 2026
f17391f
Merge branch 'main' of https://github.com/Expensify/App into onyxConn…
ShridharGoel May 27, 2026
24ef926
Merge branch 'main' of https://github.com/Expensify/App into onyxConn…
ShridharGoel May 27, 2026
35524bf
Avoid unnecessary archived report set rebuilds
ShridharGoel May 28, 2026
9df9358
Fix archived reports loading fallback
ShridharGoel Jun 3, 2026
a0f2fa9
Revert archived reports loading fallback
ShridharGoel Jun 3, 2026
f2bfde7
Merge main into onyxConnect2.2
ShridharGoel Jun 3, 2026
f123c84
Fix archived reports merge follow-ups
ShridharGoel Jun 3, 2026
e3f5987
Merge branch 'main' of https://github.com/Expensify/App into onyxConn…
ShridharGoel Jun 3, 2026
ae754ec
Address archived reports review follow-ups
ShridharGoel Jun 5, 2026
488c352
Merge main into onyxConnect2.2
ShridharGoel Jun 5, 2026
c9ddd7c
Remove unused report name value pairs utility
ShridharGoel Jun 5, 2026
43c7c8c
Address comment
ShridharGoel Jun 8, 2026
afcf425
Update tests
ShridharGoel Jun 8, 2026
c5d7849
Flatten search transaction selection params
ShridharGoel Jun 9, 2026
ecc673f
Merge branch 'main' of https://github.com/Expensify/App into onyxConn…
ShridharGoel Jun 9, 2026
e6407bc
Merge branch 'main' into onyxConnect2.2
ShridharGoel Jun 9, 2026
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import type {OnyxEntry} from 'react-native-onyx';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import useArchivedReportsIDSet from '@hooks/useArchivedReportsIDSet';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useOutstandingReports from '@hooks/useOutstandingReports';
Expand All @@ -15,7 +16,7 @@ import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type * as OnyxTypes from '@src/types/onyx';
import type {Participant} from '@src/types/onyx/IOU';
import {createOutstandingReportsForPolicySelector, createOutstandingReportsNVPsSelector, reportFieldTransactionStateSelector} from './selectors';
import {createOutstandingReportsForPolicySelector, reportFieldTransactionStateSelector} from './selectors';
import useTransactionSelector from './useTransactionSelector';

type ReportFieldProps = {
Expand Down Expand Up @@ -51,9 +52,7 @@ function ReportField({selectedParticipants, iouType, reportID, reportActionID, a
const reportAttributes = useReportAttributes();
const policyID = selectedParticipants?.at(0)?.policyID;
const [outstandingReportsForPolicy] = useOnyx(ONYXKEYS.DERIVED.OUTSTANDING_REPORTS_BY_POLICY_ID, {selector: createOutstandingReportsForPolicySelector(policyID)}, [policyID]);
const [reportNameValuePairs] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS, {selector: createOutstandingReportsNVPsSelector(outstandingReportsForPolicy)}, [
outstandingReportsForPolicy,
]);
const archivedReportsIDSet = useArchivedReportsIDSet();

// Self-resolved narrow slice of the transaction; replaces the previously prop-drilled `transaction` object.
const transactionState = useTransactionSelector(transactionID, reportFieldTransactionStateSelector);
Expand All @@ -73,11 +72,11 @@ function ReportField({selectedParticipants, iouType, reportID, reportActionID, a
* We need to check if the transaction report exists first in order to prevent the outstanding reports from being used.
* Also we need to check if transaction report exists in outstanding reports in order to show a correct report name.
*/
const shouldUseTransactionReport = (!!transactionReportEntry && isReportOutstanding(transactionReportEntry, policyID, undefined, false)) || isUnreported;
const shouldUseTransactionReport = (!!transactionReportEntry && isReportOutstanding(transactionReportEntry, policyID, archivedReportsIDSet, false)) || isUnreported;

const ownerAccountID = selectedParticipants?.at(0)?.ownerAccountID;

const availableOutstandingReports = getOutstandingReportsForUser(policyID, ownerAccountID, outstandingReportsForPolicy ?? {}, reportNameValuePairs, false).sort((a, b) =>
const availableOutstandingReports = getOutstandingReportsForUser(policyID, ownerAccountID, archivedReportsIDSet, outstandingReportsForPolicy ?? {}, false).sort((a, b) =>
localeCompare(a?.reportName?.toLowerCase() ?? '', b?.reportName?.toLowerCase() ?? ''),
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/** Onyx selectors used by the confirmation field leaves. */
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import {canSendInvoice} from '@libs/PolicyUtils';
import getReportNameValuePairsForReports from '@libs/ReportNameValuePairsUtils';
import {
getCategory,
getCreated,
Expand Down Expand Up @@ -302,7 +301,6 @@ type ReportFieldTransactionState = {
isFromGlobalCreate: boolean;
participantReportID: string | undefined;
};
type OutstandingReportsForPolicy = OnyxTypes.OutstandingReportsByPolicyIDDerivedValue[string];

const reportFieldTransactionStateSelector = (t: OnyxEntry<Transaction>): ReportFieldTransactionState | undefined => {
if (!t) {
Expand All @@ -318,15 +316,6 @@ const reportFieldTransactionStateSelector = (t: OnyxEntry<Transaction>): ReportF
const createOutstandingReportsForPolicySelector = (policyID: string | undefined) => (derived: OnyxEntry<OnyxTypes.OutstandingReportsByPolicyIDDerivedValue>) =>
derived?.[policyID ?? CONST.DEFAULT_NUMBER_ID];

const createOutstandingReportsNVPsSelector =
(outstandingReports: OutstandingReportsForPolicy | undefined) =>
(allNVPs: OnyxCollection<OnyxTypes.ReportNameValuePairs>): OnyxCollection<OnyxTypes.ReportNameValuePairs> | undefined => {
if (!outstandingReports || !allNVPs) {
return undefined;
}
return getReportNameValuePairsForReports(outstandingReports, allNVPs);
};

// --- InvoiceSenderField ---

type InvoiceSenderWorkspace = {id: string | undefined; name: string | undefined; avatarURL: string | undefined} | undefined;
Expand All @@ -350,7 +339,6 @@ export {
attendeeSliceSelector,
categoryStateSelector,
createCanUpdateSenderWorkspaceSelector,
createOutstandingReportsNVPsSelector,
createOutstandingReportsForPolicySelector,
createTagDisplaySelector,
dateStateSelector,
Expand Down
157 changes: 98 additions & 59 deletions src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {SelectionListHandle} from '@components/SelectionList/types';
import SearchRowSkeleton from '@components/Skeletons/SearchRowSkeleton';
import {useWideRHPActions} from '@components/WideRHPContextProvider';
import useActionLoadingReportIDs from '@hooks/useActionLoadingReportIDs';
import useArchivedReportsIdSet from '@hooks/useArchivedReportsIdSet';
import useArchivedReportsIDSet from '@hooks/useArchivedReportsIDSet';
import {useCurrencyListActions} from '@hooks/useCurrencyList';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useEnvironment from '@hooks/useEnvironment';
Expand Down Expand Up @@ -66,6 +66,7 @@ import {
shouldShowEmptyState,
shouldShowYear as shouldShowYearUtil,
} from '@libs/SearchUIUtils';
import type {ArchivedReportsIDSet} from '@libs/SearchUIUtils';
import {cancelSpan, endSpanWithAttributes, getSpan, startSpan} from '@libs/telemetry/activeSpans';
import {
cancelNavigateToReportsSpans,
Expand Down Expand Up @@ -125,18 +126,33 @@ type HoldMenuCallback = (item: TransactionReportGroupListItemType, requestType:

const hashToString = (queryHash?: number) => (queryHash || queryHash === 0 ? String(queryHash) : undefined);

function mapTransactionItemToSelectedEntry(
item: TransactionListItemType,
itemTransaction: OnyxEntry<Transaction>,
originalItemTransaction: OnyxEntry<Transaction>,
currentUserLogin: string,
currentUserAccountID: number,
outstandingReportsByPolicyID: OutstandingReportsByPolicyIDDerivedValue | undefined,
allowNegativeAmount: boolean,
parentReport: OnyxEntry<Report> | undefined,
selfDMReport: OnyxEntry<Report> | undefined,
isProduction: boolean,
): [string, SelectedTransactionInfo] {
type MapTransactionItemToSelectedEntryParams = {
item: TransactionListItemType;
itemTransaction: OnyxEntry<Transaction>;
originalItemTransaction: OnyxEntry<Transaction>;
currentUserLogin: string;
currentUserAccountID: number;
archivedReportsIDSet: ArchivedReportsIDSet;
outstandingReportsByPolicyID: OutstandingReportsByPolicyIDDerivedValue | undefined;
selfDMReport: OnyxEntry<Report>;
isProduction: boolean;
allowNegativeAmount: boolean;
parentReport: OnyxEntry<Report> | undefined;
};

function mapTransactionItemToSelectedEntry({
item,
itemTransaction,
originalItemTransaction,
currentUserLogin,
currentUserAccountID,
archivedReportsIDSet,
outstandingReportsByPolicyID,
selfDMReport,
isProduction,
allowNegativeAmount,
parentReport,
}: MapTransactionItemToSelectedEntryParams): [string, SelectedTransactionInfo] {
const {canHoldRequest, canUnholdRequest} = canHoldUnholdReportAction(item.report, item.reportAction, item.holdReportAction, item, item.policy, currentUserAccountID);
const canRejectRequest = item.report ? canRejectReportAction(currentUserLogin, item.report) : false;
const amount = hasValidModifiedAmount(item) ? Number(item.modifiedAmount) : item.amount;
Expand All @@ -161,6 +177,7 @@ function mapTransactionItemToSelectedEntry(
transaction: item,
report: item.report,
policy: item.policy,
archivedReportsIDSet,
}),
action: item.action,
groupCurrency: item.groupCurrency,
Expand Down Expand Up @@ -228,36 +245,52 @@ function mapEmptyReportToSelectedEntry(item: TransactionReportGroupListItemType
];
}

function prepareTransactionsList(
item: TransactionListItemType,
itemTransaction: OnyxEntry<Transaction>,
originalItemTransaction: OnyxEntry<Transaction>,
selectedTransactions: SelectedTransactions,
currentUserLogin: string,
currentUserAccountID: number,
outstandingReportsByPolicyID: OutstandingReportsByPolicyIDDerivedValue | undefined,
parentReport: OnyxEntry<Report> | undefined,
selfDMReport: OnyxEntry<Report> | undefined,
isProduction: boolean,
) {
type PrepareTransactionsListParams = {
item: TransactionListItemType;
itemTransaction: OnyxEntry<Transaction>;
originalItemTransaction: OnyxEntry<Transaction>;
selectedTransactions: SelectedTransactions;
currentUserLogin: string;
currentUserAccountID: number;
archivedReportsIDSet: ArchivedReportsIDSet;
outstandingReportsByPolicyID: OutstandingReportsByPolicyIDDerivedValue | undefined;
selfDMReport: OnyxEntry<Report>;
isProduction: boolean;
parentReport: OnyxEntry<Report> | undefined;
};

function prepareTransactionsList({
item,
itemTransaction,
originalItemTransaction,
selectedTransactions,
currentUserLogin,
currentUserAccountID,
archivedReportsIDSet,
outstandingReportsByPolicyID,
selfDMReport,
isProduction,
parentReport,
}: PrepareTransactionsListParams) {
if (selectedTransactions[item.keyForList]?.isSelected) {
const {[item.keyForList]: omittedTransaction, ...transactions} = selectedTransactions;

return transactions;
}

const [key, selectedInfo] = mapTransactionItemToSelectedEntry(
const [key, selectedInfo] = mapTransactionItemToSelectedEntry({
item,
itemTransaction,
originalItemTransaction,
currentUserLogin,
currentUserAccountID,
archivedReportsIDSet,
outstandingReportsByPolicyID,
false,
parentReport,
selfDMReport,
isProduction,
);
allowNegativeAmount: false,
parentReport,
});

return {
...selectedTransactions,
Expand Down Expand Up @@ -331,7 +364,7 @@ function Search({

const isExpenseReportType = type === CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT;

const archivedReportsIdSet = useArchivedReportsIdSet();
const archivedReportsIDSet = useArchivedReportsIDSet();

const [exportReportActions] = useOnyx<typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS, Record<string, ReportAction[]> | undefined>(ONYXKEYS.COLLECTION.REPORT_ACTIONS, {
selector: selectFilteredReportActions,
Expand Down Expand Up @@ -564,7 +597,7 @@ function Search({
groupBy: validGroupBy,
reportActions: exportReportActions,
currentSearch: currentSearchKey,
archivedReportsIDList: archivedReportsIdSet,
archivedReportsIDList: archivedReportsIDSet,
queryJSON,
isActionLoadingSet,
cardFeeds,
Expand Down Expand Up @@ -594,7 +627,7 @@ function Search({
searchDataWithOptimisticTransaction,
searchResults,
type,
archivedReportsIdSet,
archivedReportsIDSet,
translate,
formatPhoneNumber,
accountID,
Expand Down Expand Up @@ -1058,18 +1091,19 @@ function Search({
const itemTransaction = transactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${item.transactionID}`] as OnyxEntry<Transaction>;
const originalItemTransaction = transactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${itemTransaction?.comment?.originalTransactionID}`];
const itemParentReport = searchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${item.report?.parentReportID}`] as OnyxEntry<Report>;
const updatedTransactions = prepareTransactionsList(
const updatedTransactions = prepareTransactionsList({
item,
itemTransaction,
originalItemTransaction,
selectedTransactions,
email ?? '',
accountID,
currentUserLogin: email ?? '',
currentUserAccountID: accountID,
archivedReportsIDSet,
outstandingReportsByPolicyID,
itemParentReport,
selfDMReport,
isProduction,
);
parentReport: itemParentReport,
});

// Tag individual transactions with their parent group key so export filtering can derive the group when needed.
if (areItemsGrouped) {
Expand Down Expand Up @@ -1141,18 +1175,19 @@ function Search({
searchResults?.data?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${itemTransaction?.comment?.originalTransactionID}`] ??
transactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${itemTransaction?.comment?.originalTransactionID}`];
const itemParentReport = searchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${transactionItem.report?.parentReportID}`] as OnyxEntry<Report>;
const [key, entry] = mapTransactionItemToSelectedEntry(
transactionItem,
const [key, entry] = mapTransactionItemToSelectedEntry({
item: transactionItem,
itemTransaction,
originalItemTransaction,
email ?? '',
accountID,
currentUserLogin: email ?? '',
currentUserAccountID: accountID,
archivedReportsIDSet,
outstandingReportsByPolicyID,
true,
itemParentReport,
selfDMReport,
isProduction,
);
allowNegativeAmount: true,
parentReport: itemParentReport,
});
return [key, {...entry, groupKey: item.keyForList}];
}),
),
Expand All @@ -1168,6 +1203,7 @@ function Search({
searchResults?.data,
email,
accountID,
archivedReportsIDSet,
outstandingReportsByPolicyID,
selfDMReport,
isProduction,
Expand Down Expand Up @@ -1488,18 +1524,19 @@ function Search({
const itemTransaction = transactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionItem.transactionID}`] as OnyxEntry<Transaction>;
const originalItemTransaction = transactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${itemTransaction?.comment?.originalTransactionID}`];
const itemParentReport = searchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${transactionItem.report?.parentReportID}`] as OnyxEntry<Report>;
const [key, entry] = mapTransactionItemToSelectedEntry(
transactionItem,
const [key, entry] = mapTransactionItemToSelectedEntry({
item: transactionItem,
itemTransaction,
originalItemTransaction,
email ?? '',
accountID,
currentUserLogin: email ?? '',
currentUserAccountID: accountID,
archivedReportsIDSet,
outstandingReportsByPolicyID,
true,
itemParentReport,
selfDMReport,
isProduction,
);
allowNegativeAmount: true,
parentReport: itemParentReport,
});
return [key, {...entry, groupKey: item.keyForList}] as [string, SelectedTransactionInfo];
});
});
Expand All @@ -1513,18 +1550,19 @@ function Search({
const itemTransaction = searchResults?.data?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionItem.transactionID}`] as OnyxEntry<Transaction>;
const originalItemTransaction = searchResults?.data?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${itemTransaction?.comment?.originalTransactionID}`];
const itemParentReport = searchResults?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${transactionItem.report?.parentReportID}`] as OnyxEntry<Report>;
return mapTransactionItemToSelectedEntry(
transactionItem,
return mapTransactionItemToSelectedEntry({
item: transactionItem,
itemTransaction,
originalItemTransaction,
email ?? '',
accountID,
currentUserLogin: email ?? '',
currentUserAccountID: accountID,
archivedReportsIDSet,
outstandingReportsByPolicyID,
true,
itemParentReport,
selfDMReport,
isProduction,
);
allowNegativeAmount: true,
parentReport: itemParentReport,
});
}),
);
}
Expand All @@ -1538,10 +1576,11 @@ function Search({
updateSelectAllMatchingItemsState,
clearSelectedTransactions,
transactions,
searchResults?.data,
email,
accountID,
archivedReportsIDSet,
outstandingReportsByPolicyID,
searchResults?.data,
selfDMReport,
isProduction,
]);
Expand Down
15 changes: 15 additions & 0 deletions src/hooks/useArchivedReportsIDSet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {buildArchivedReportsIDSet} from '@libs/ReportUtils';
import type {ArchivedReportsIDSet} from '@libs/SearchUIUtils';
import ONYXKEYS from '@src/ONYXKEYS';
import useOnyx from './useOnyx';

/**
* Hook that returns a Set of archived report IDs
*/
function useArchivedReportsIDSet(): ArchivedReportsIDSet {
const [reportNameValuePairs] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS);

return buildArchivedReportsIDSet(reportNameValuePairs);
Comment thread
ShridharGoel marked this conversation as resolved.
}

export default useArchivedReportsIDSet;
Loading
Loading