Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Expand Up @@ -131,6 +131,7 @@ function MoneyRequestReportActionsList({
const linkedReportActionID = route?.params?.reportActionID;

const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false});
Comment thread
Pujan92 marked this conversation as resolved.
const [parentReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getNonEmptyStringOnyxID(report?.parentReportID)}`, {
canEvict: false,
canBeMissing: true,
Expand Down Expand Up @@ -470,6 +471,7 @@ function MoneyRequestReportActionsList({
return (
<ReportActionsListItemRenderer
allReports={allReports}
policies={policies}
reportAction={reportAction}
reportActions={reportActions}
parentReportAction={parentReportAction}
Expand Down Expand Up @@ -498,6 +500,7 @@ function MoneyRequestReportActionsList({
firstVisibleReportActionID,
linkedReportActionID,
allReports,
policies,
],
);

Expand Down
10 changes: 8 additions & 2 deletions src/components/ReportActionItem/MoneyRequestAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {useRoute} from '@react-navigation/native';
import lodashIsEmpty from 'lodash/isEmpty';
import React, {useMemo} from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import type {OnyxCollection} from 'react-native-onyx';
import RenderHTML from '@components/RenderHTML';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
Expand Down Expand Up @@ -34,6 +35,9 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject';
import TransactionPreview from './TransactionPreview';

type MoneyRequestActionProps = {
/** All the data of the report collection */
allReports: OnyxCollection<OnyxTypes.Report>;

/** All the data of the action */
action: OnyxTypes.ReportAction;

Expand Down Expand Up @@ -69,6 +73,7 @@ type MoneyRequestActionProps = {
};

function MoneyRequestAction({
allReports,
action,
chatReportID,
requestReportID,
Expand All @@ -81,8 +86,8 @@ function MoneyRequestAction({
isWhisper = false,
shouldDisplayContextMenu = true,
}: MoneyRequestActionProps) {
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`, {canBeMissing: true});
const [iouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${requestReportID}`, {canBeMissing: true});
const chatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`];
const iouReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${requestReportID}`];
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReportID}`, {canEvict: false, canBeMissing: true});
const StyleUtils = useStyleUtils();
const styles = useThemeStyles();
Expand Down Expand Up @@ -151,6 +156,7 @@ function MoneyRequestAction({

return (
<TransactionPreview
allReports={allReports}
iouReportID={requestReportID}
chatReportID={chatReportID}
reportID={reportID}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useCallback, useMemo, useState} from 'react';
import type {LayoutChangeEvent, ListRenderItem} from 'react-native';
import {usePersonalDetails} from '@components/OnyxProvider';
import TransactionPreview from '@components/ReportActionItem/TransactionPreview';
import useOnyx from '@hooks/useOnyx';
import usePolicy from '@hooks/usePolicy';
import useReportWithTransactionsAndViolations from '@hooks/useReportWithTransactionsAndViolations';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
Expand All @@ -22,6 +22,8 @@ import MoneyRequestReportPreviewContent from './MoneyRequestReportPreviewContent
import type {MoneyRequestReportPreviewProps} from './types';

function MoneyRequestReportPreview({
allReports,
policies,
iouReportID,
policyID,
chatReportID,
Expand All @@ -39,16 +41,11 @@ function MoneyRequestReportPreview({
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`, {canBeMissing: true});
const [invoiceReceiverPolicy] = useOnyx(
`${ONYXKEYS.COLLECTION.POLICY}${chatReport?.invoiceReceiver && 'policyID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.policyID : undefined}`,
{canBeMissing: true},
);
const [invoiceReceiverPersonalDetail] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
selector: (personalDetails) =>
personalDetails?.[chatReport?.invoiceReceiver && 'accountID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.accountID : CONST.DEFAULT_NUMBER_ID],
canBeMissing: true,
});
const personalDetailsList = usePersonalDetails();
const chatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`];
const invoiceReceiverPolicy =
policies?.[`${ONYXKEYS.COLLECTION.POLICY}${chatReport?.invoiceReceiver && 'policyID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.policyID : undefined}`];
const invoiceReceiverPersonalDetail = chatReport?.invoiceReceiver && 'accountID' in chatReport.invoiceReceiver ? personalDetailsList?.[chatReport.invoiceReceiver.accountID] : null;
const [iouReport, transactions, violations] = useReportWithTransactionsAndViolations(iouReportID);
const policy = usePolicy(policyID);
const lastTransaction = transactions?.at(0);
Expand Down Expand Up @@ -83,6 +80,7 @@ function MoneyRequestReportPreview({

const renderItem: ListRenderItem<Transaction> = ({item}) => (
<TransactionPreview
allReports={allReports}
chatReportID={chatReportID}
action={getIOUActionForReportID(item.reportID, item.transactionID)}
contextAction={action}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ type MoneyRequestReportPreviewStyleType = {
};

type MoneyRequestReportPreviewProps = {
/** All the data of the report collection */
allReports: OnyxCollection<Report>;

/** All the data of the policy collection */
policies: OnyxCollection<Policy>;

/** The report's policyID, used for Onyx subscription */
policyID: string | undefined;

Expand Down Expand Up @@ -70,12 +76,12 @@ type MoneyRequestReportPreviewContentOnyxProps = {
transactions: Transaction[];
violations: OnyxCollection<TransactionViolation[]>;
policy: OnyxEntry<Policy>;
invoiceReceiverPersonalDetail: OnyxEntry<PersonalDetails>;
invoiceReceiverPersonalDetail: OnyxEntry<PersonalDetails> | null;
lastTransactionViolations: TransactionViolations;
};

type MoneyRequestReportPreviewContentProps = MoneyRequestReportPreviewContentOnyxProps &
Omit<MoneyRequestReportPreviewProps, 'policyID'> & {
Omit<MoneyRequestReportPreviewProps, 'allReports' | 'policies' | 'policyID'> & {
/** Extra styles passed used by MoneyRequestReportPreviewContent */
reportPreviewStyles: MoneyRequestReportPreviewStyleType;

Expand Down
10 changes: 6 additions & 4 deletions src/components/ReportActionItem/TransactionPreview/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {useRoute} from '@react-navigation/native';
import React, {useCallback, useMemo} from 'react';
import type {GestureResponderEvent} from 'react-native';
import {usePersonalDetails, useSession} from '@components/OnyxProvider';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import {showContextMenuForReport} from '@components/ShowContextMenuContext';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -28,6 +29,7 @@ import type {TransactionPreviewProps} from './types';
function TransactionPreview(props: TransactionPreviewProps) {
const {translate} = useLocalize();
const {
allReports,
action,
chatReportID,
reportID,
Expand All @@ -41,16 +43,16 @@ function TransactionPreview(props: TransactionPreviewProps) {
contextAction,
} = props;

const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`, {canBeMissing: true});
const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`];
const route = useRoute<PlatformStackRouteProp<TransactionDuplicateNavigatorParamList, typeof SCREENS.TRANSACTION_DUPLICATE.REVIEW>>();
const isMoneyRequestAction = isMoneyRequestActionReportActionsUtils(action);
const transactionID = transactionIDFromProps ?? (isMoneyRequestAction ? getOriginalMessage(action)?.IOUTransactionID : null);
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {canBeMissing: true});
const violations = useTransactionViolations(transaction?.transactionID);
const [walletTerms] = useOnyx(ONYXKEYS.WALLET_TERMS, {canBeMissing: true});
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: true});
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`, {canBeMissing: true});
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: true});
const session = useSession();
const chatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`];
const personalDetails = usePersonalDetails();
Comment thread
Pujan92 marked this conversation as resolved.

// Get transaction violations for given transaction id from onyx, find duplicated transactions violations and get duplicates
const allDuplicateIDs = useMemo(() => violations?.find((violation) => violation.name === CONST.VIOLATIONS.DUPLICATED_TRANSACTION)?.data?.duplicates ?? [], [violations]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {GestureResponderEvent, StyleProp, ViewStyle} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import type {ContextMenuAnchor} from '@pages/home/report/ContextMenu/ReportActionContextMenu';
import type {PersonalDetailsList, Report, ReportAction, Transaction, TransactionViolations} from '@src/types/onyx';
import type {Errors} from '@src/types/onyx/OnyxCommon';
Expand All @@ -11,6 +11,9 @@ type TransactionPreviewStyleType = {
};

type TransactionPreviewProps = {
/** All the data of the report collection */
allReports: OnyxCollection<Report>;

/** The active reportID linked to the transaction */
iouReportID: string | undefined;

Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@
const parsedReportActionMessageCache: Record<string, string> = {};

let conciergeReportID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 887 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportID = value;
Expand All @@ -892,7 +892,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 895 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -910,7 +910,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 913 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (currentUserAccountID) {
Expand All @@ -922,14 +922,14 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 925 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
});

let allPolicies: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 932 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => (allPolicies = value),
Expand All @@ -937,7 +937,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 940 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -974,14 +974,14 @@
});

let allBetas: OnyxEntry<Beta[]>;
Onyx.connect({

Check warning on line 977 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETAS,
callback: (value) => (allBetas = value),
});

let allTransactions: OnyxCollection<Transaction> = {};
let reportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 984 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1007,7 +1007,7 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 1010 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand All @@ -1020,7 +1020,7 @@

let allReportMetadata: OnyxCollection<ReportMetadata>;
const allReportMetadataKeyValue: Record<string, ReportMetadata> = {};
Onyx.connect({

Check warning on line 1023 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_METADATA,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -4794,7 +4794,7 @@
* - Individual - a receiver display name.
* - Policy - a receiver policy name.
*/
function getInvoicePayerName(report: OnyxEntry<Report>, invoiceReceiverPolicy?: OnyxEntry<Policy> | SearchPolicy, invoiceReceiverPersonalDetail?: PersonalDetails): string {
function getInvoicePayerName(report: OnyxEntry<Report>, invoiceReceiverPolicy?: OnyxEntry<Policy> | SearchPolicy, invoiceReceiverPersonalDetail?: PersonalDetails | null): string {
const invoiceReceiver = report?.invoiceReceiver;
const isIndividual = invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function DebugReportActionCreatePage({
const {translate} = useLocalize();
const styles = useThemeStyles();
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false});
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
const [personalDetailsList] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: false});
const [draftReportAction, setDraftReportAction] = useState<string>(() => getInitialReportAction(reportID, session, personalDetailsList));
Expand Down Expand Up @@ -108,6 +109,7 @@ function DebugReportActionCreatePage({
{!error ? (
<ReportActionItem
allReports={allReports}
policies={policies}
action={JSON.parse(draftReportAction.replaceAll('\n', '')) as ReportAction}
report={{reportID}}
reportActions={[]}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Debug/ReportAction/DebugReportActionPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ type DebugReportActionPreviewProps = {

function DebugReportActionPreview({reportAction, reportID}: DebugReportActionPreviewProps) {
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false});
const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`];

return (
<ScrollView>
<ReportActionItem
allReports={allReports}
policies={policies}
action={reportAction ?? ({} as ReportAction)}
report={report ?? ({} as Report)}
reportActions={[]}
Expand Down
7 changes: 5 additions & 2 deletions src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ import {getOriginalMessage, getReportAction, isMoneyRequestAction} from '@libs/R
import ReportActionItem from '@pages/home/report/ReportActionItem';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Report, Transaction} from '@src/types/onyx';
import type {Policy, Report, Transaction} from '@src/types/onyx';

type DuplicateTransactionItemProps = {
transaction: OnyxEntry<Transaction>;
index: number;
allReports: OnyxCollection<Report>;
/** All the data of the policy collection */
policies: OnyxCollection<Policy>;
};

function DuplicateTransactionItem({transaction, index, allReports}: DuplicateTransactionItemProps) {
function DuplicateTransactionItem({transaction, index, allReports, policies}: DuplicateTransactionItemProps) {
const styles = useThemeStyles();
const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID}`];
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.reportID}`, {canBeMissing: false});
Expand All @@ -34,6 +36,7 @@ function DuplicateTransactionItem({transaction, index, allReports}: DuplicateTra
<View style={styles.pb2}>
<ReportActionItem
allReports={allReports}
policies={policies}
action={action}
report={report}
parentReportAction={getReportAction(report?.parentReportID, report?.parentReportActionID)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ function DuplicateTransactionsList({transactions}: DuplicateTransactionsListProp
const styles = useThemeStyles();

const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false});

const renderItem = useCallback(
({item, index}: ListRenderItemInfo<OnyxEntry<Transaction>>) => (
<DuplicateTransactionItem
transaction={item}
index={index}
allReports={allReports}
policies={policies}
/>
),
[allReports],
[allReports, policies],
);

return (
Expand Down
16 changes: 12 additions & 4 deletions src/pages/home/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ import ReportActionItemThread from './ReportActionItemThread';
import TripSummary from './TripSummary';

type PureReportActionItemProps = {
/** All the data of the report collection */
allReports: OnyxCollection<OnyxTypes.Report>;

/** All the data of the policy collection */
policies: OnyxCollection<OnyxTypes.Policy>;

/** Report for this action */
report: OnyxEntry<OnyxTypes.Report>;

Expand Down Expand Up @@ -351,9 +357,6 @@ type PureReportActionItemProps = {
/** User payment card ID */
userBillingFundID?: number;

/** Policies */
policies?: OnyxCollection<OnyxTypes.Policy>;

/** Whether to show border for MoneyRequestReportPreviewContent */
shouldShowBorder?: boolean;
};
Expand All @@ -370,6 +373,8 @@ const isEmptyHTML = <T extends React.JSX.Element>({props: {html}}: T): boolean =
* Instead, pass all Onyx read/write operations as props.
*/
function PureReportActionItem({
allReports,
policies,
action,
report,
policy,
Expand Down Expand Up @@ -417,7 +422,6 @@ function PureReportActionItem({
clearAllRelatedReportActionErrors = () => {},
dismissTrackExpenseActionableWhisper = () => {},
userBillingFundID,
policies,
shouldShowBorder,
}: PureReportActionItemProps) {
const actionSheetAwareScrollViewContext = useContext(ActionSheetAwareScrollView.ActionSheetAwareScrollViewContext);
Expand Down Expand Up @@ -845,6 +849,7 @@ function PureReportActionItem({
const iouReportID = moneyRequestOriginalMessage?.IOUReportID?.toString();
children = (
<MoneyRequestAction
allReports={allReports}
// If originalMessage.iouReportID is set, this is a 1:1 IOU expense in a DM chat whose reportID is report.chatReportID
chatReportID={chatReportID}
requestReportID={iouReportID}
Expand All @@ -865,6 +870,7 @@ function PureReportActionItem({
children = (
<View style={[styles.mt1, styles.w100]}>
<TransactionPreview
allReports={allReports}
iouReportID={getIOUReportIDFromReportActionPreview(action)}
chatReportID={reportID}
reportID={reportID}
Expand Down Expand Up @@ -912,6 +918,8 @@ function PureReportActionItem({
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW) {
children = (
<MoneyRequestReportPreview
allReports={allReports}
policies={policies}
iouReportID={getIOUReportIDFromReportActionPreview(action)}
policyID={report?.policyID}
chatReportID={reportID}
Expand Down
9 changes: 7 additions & 2 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,25 @@ import {clearAllRelatedReportActionErrors} from '@userActions/ReportActions';
import {clearError} from '@userActions/Transaction';
import type CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Report, ReportAction, Transaction} from '@src/types/onyx';
import type {Policy, Report, ReportAction, Transaction} from '@src/types/onyx';
import type {PureReportActionItemProps} from './PureReportActionItem';
import PureReportActionItem from './PureReportActionItem';

type ReportActionItemProps = Omit<PureReportActionItemProps, 'taskReport' | 'linkedReport' | 'iouReportOfLinkedReport'> & {
/** All the data of the report collection */
allReports: OnyxCollection<Report>;

/** All the data of the policy collection */
policies: OnyxCollection<Policy>;

/** Whether to show the draft message or not */
shouldShowDraftMessage?: boolean;

/** All the data of the transaction collection */
transactions?: Array<OnyxEntry<Transaction>>;
};

function ReportActionItem({allReports, action, report, transactions, shouldShowDraftMessage = true, ...props}: ReportActionItemProps) {
function ReportActionItem({allReports, policies, action, report, transactions, shouldShowDraftMessage = true, ...props}: ReportActionItemProps) {
const reportID = report?.reportID;
const originalMessage = getOriginalMessage(action);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Expand Down Expand Up @@ -87,6 +90,8 @@ function ReportActionItem({allReports, action, report, transactions, shouldShowD
<PureReportActionItem
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
allReports={allReports}
policies={policies}
action={action}
report={report}
policy={policy}
Expand Down
Loading
Loading