diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 2c592c20f4c6..10fb0430dec7 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -102,9 +102,6 @@ type MoneyRequestConfirmationListProps = MoneyRequestConfirmationListOnyxProps & /** Callback to inform a participant is selected */ onSelectParticipant?: (option: Participant) => void; - /** Should we request a single or multiple participant selection from user */ - hasMultipleParticipants: boolean; - /** IOU amount */ iouAmount: number; @@ -209,7 +206,6 @@ function MoneyRequestConfirmationList({ policyTags, iouCurrencyCode, iouMerchant, - hasMultipleParticipants, selectedParticipants: selectedParticipantsProp, payeePersonalDetails: payeePersonalDetailsProp, session, @@ -466,6 +462,9 @@ function MoneyRequestConfirmationList({ const shouldShowReadOnlySplits = useMemo(() => isPolicyExpenseChat || isReadOnly || isScanRequest, [isPolicyExpenseChat, isReadOnly, isScanRequest]); const splitParticipants = useMemo(() => { + if (!isTypeSplit) { + return; + } const payeeOption = OptionsListUtils.getIOUConfirmationOptionsFromPayeePersonalDetail(payeePersonalDetails); if (shouldShowReadOnlySplits) { return [payeeOption, ...selectedParticipants].map((participantOption: Participant) => { @@ -501,7 +500,7 @@ function MoneyRequestConfirmationList({ onAmountChange: (value: string) => onSplitShareChange(participantOption.accountID ?? 0, Number(value)), }, })); - }, [transaction, iouCurrencyCode, onSplitShareChange, payeePersonalDetails, selectedParticipants, currencyList, iouAmount, shouldShowReadOnlySplits, StyleUtils]); + }, [isTypeSplit, transaction, iouCurrencyCode, onSplitShareChange, payeePersonalDetails, selectedParticipants, currencyList, iouAmount, shouldShowReadOnlySplits, StyleUtils]); const isSplitModified = useMemo(() => { if (!transaction?.splitShares) { @@ -512,7 +511,7 @@ function MoneyRequestConfirmationList({ const optionSelectorSections = useMemo(() => { const sections = []; - if (hasMultipleParticipants) { + if (isTypeSplit) { sections.push( ...[ { @@ -543,14 +542,14 @@ function MoneyRequestConfirmationList({ }); } return sections; - }, [selectedParticipants, hasMultipleParticipants, translate, splitParticipants, transaction, shouldShowReadOnlySplits, isSplitModified, payeePersonalDetails]); + }, [selectedParticipants, isTypeSplit, translate, splitParticipants, transaction, shouldShowReadOnlySplits, isSplitModified, payeePersonalDetails]); const selectedOptions = useMemo(() => { - if (!hasMultipleParticipants) { + if (!isTypeSplit) { return []; } return [...selectedParticipants, OptionsListUtils.getIOUConfirmationOptionsFromPayeePersonalDetail(payeePersonalDetails)]; - }, [selectedParticipants, hasMultipleParticipants, payeePersonalDetails]); + }, [selectedParticipants, isTypeSplit, payeePersonalDetails]); useEffect(() => { if (!isDistanceRequest || isMovingTransactionFromTrackExpense) { diff --git a/src/pages/iou/SplitBillDetailsPage.tsx b/src/pages/iou/SplitBillDetailsPage.tsx index 157f14d1dde5..51b432d7e860 100644 --- a/src/pages/iou/SplitBillDetailsPage.tsx +++ b/src/pages/iou/SplitBillDetailsPage.tsx @@ -107,7 +107,6 @@ function SplitBillDetailsPage({personalDetails, report, route, reportActions, tr )} {!!participants.length && ( ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(report)) || ReportUtils.isGroupPolicy(policy?.type ?? ''), [report, policy]); + const isPolicyExpenseChat = useMemo(() => participants?.some((participant) => participant.isPolicyExpenseChat), [participants]); const formHasBeenSubmitted = useRef(false); useEffect(() => { @@ -558,7 +558,6 @@ function IOURequestStepConfirmation({ />