diff --git a/src/components/MoneyTemporaryForRefactorRequestConfirmationList.js b/src/components/MoneyTemporaryForRefactorRequestConfirmationList.js index e622367cd6f9..a85322978b33 100755 --- a/src/components/MoneyTemporaryForRefactorRequestConfirmationList.js +++ b/src/components/MoneyTemporaryForRefactorRequestConfirmationList.js @@ -231,7 +231,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({ receiptPath, reportActionID, reportID, - selectedParticipants, + selectedParticipants: pickedParticipants, session: {accountID}, shouldShowSmartScanFields, transaction, @@ -358,7 +358,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({ ]; }, [isTypeSplit, isTypeRequest, iouType, iouAmount, receiptPath, formattedAmount, isDistanceRequestWithoutRoute, translate]); - const selectedParticipantsFiltered = useMemo(() => _.filter(selectedParticipants, (participant) => participant.selected), [selectedParticipants]); + const selectedParticipants = useMemo(() => _.filter(pickedParticipants, (participant) => participant.selected), [pickedParticipants]); const personalDetailsOfPayee = useMemo(() => payeePersonalDetails || currentUserPersonalDetails, [payeePersonalDetails, currentUserPersonalDetails]); const userCanModifyParticipants = useRef(!isReadOnly && canModifyParticipants && hasMultipleParticipants); useEffect(() => { @@ -368,9 +368,9 @@ function MoneyTemporaryForRefactorRequestConfirmationList({ const optionSelectorSections = useMemo(() => { const sections = []; - const unselectedParticipants = _.filter(selectedParticipantsFiltered, (participant) => !participant.selected); + const unselectedParticipants = _.filter(pickedParticipants, (participant) => !participant.selected); if (hasMultipleParticipants) { - const formattedSelectedParticipants = getParticipantsWithAmount(selectedParticipantsFiltered); + const formattedSelectedParticipants = getParticipantsWithAmount(selectedParticipants); let formattedParticipantsList = _.union(formattedSelectedParticipants, unselectedParticipants); if (!userCanModifyParticipants.current) { @@ -380,7 +380,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({ })); } - const myIOUAmount = IOUUtils.calculateAmount(selectedParticipantsFiltered.length, iouAmount, iouCurrencyCode, true); + const myIOUAmount = IOUUtils.calculateAmount(selectedParticipants.length, iouAmount, iouCurrencyCode, true); const formattedPayeeOption = OptionsListUtils.getIOUConfirmationOptionsFromPayeePersonalDetail( personalDetailsOfPayee, iouAmount > 0 ? CurrencyUtils.convertToDisplayString(myIOUAmount, iouCurrencyCode) : '', @@ -402,7 +402,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({ }, ); } else { - const formattedSelectedParticipants = _.map(selectedParticipantsFiltered, (participant) => ({ + const formattedSelectedParticipants = _.map(selectedParticipants, (participant) => ({ ...participant, isDisabled: ReportUtils.isOptimisticPersonalDetail(participant.accountID), })); @@ -415,7 +415,8 @@ function MoneyTemporaryForRefactorRequestConfirmationList({ } return sections; }, [ - selectedParticipantsFiltered, + selectedParticipants, + pickedParticipants, hasMultipleParticipants, iouAmount, iouCurrencyCode, @@ -430,8 +431,8 @@ function MoneyTemporaryForRefactorRequestConfirmationList({ if (!hasMultipleParticipants) { return []; } - return [...selectedParticipantsFiltered, OptionsListUtils.getIOUConfirmationOptionsFromPayeePersonalDetail(personalDetailsOfPayee)]; - }, [selectedParticipantsFiltered, hasMultipleParticipants, personalDetailsOfPayee]); + return [...selectedParticipants, OptionsListUtils.getIOUConfirmationOptionsFromPayeePersonalDetail(personalDetailsOfPayee)]; + }, [selectedParticipants, hasMultipleParticipants, personalDetailsOfPayee]); useEffect(() => { if (!isDistanceRequest) { @@ -474,7 +475,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({ */ const confirm = useCallback( (paymentMethod) => { - if (_.isEmpty(selectedParticipantsFiltered)) { + if (_.isEmpty(selectedParticipants)) { return; } @@ -502,10 +503,10 @@ function MoneyTemporaryForRefactorRequestConfirmationList({ } setDidConfirm(true); - onConfirm(selectedParticipantsFiltered); + onConfirm(selectedParticipants); } }, - [selectedParticipantsFiltered, onSendMoney, onConfirm, isEditingSplitBill, iouType, isDistanceRequest, isDistanceRequestWithoutRoute, iouCurrencyCode, iouAmount, transaction], + [selectedParticipants, onSendMoney, onConfirm, isEditingSplitBill, iouType, isDistanceRequest, isDistanceRequestWithoutRoute, iouCurrencyCode, iouAmount, transaction], ); const footerContent = useMemo(() => { @@ -514,7 +515,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({ } const shouldShowSettlementButton = iouType === CONST.IOU.TYPE.SEND; - const shouldDisableButton = selectedParticipantsFiltered.length === 0; + const shouldDisableButton = selectedParticipants.length === 0; const button = shouldShowSettlementButton ? ( ); - }, [confirm, bankAccountRoute, iouCurrencyCode, iouType, isReadOnly, policyID, selectedParticipantsFiltered, splitOrRequestOptions, translate, formError, styles.ph1, styles.mb2]); + }, [confirm, bankAccountRoute, iouCurrencyCode, iouType, isReadOnly, policyID, selectedParticipants, splitOrRequestOptions, translate, formError, styles.ph1, styles.mb2]); const {image: receiptImage, thumbnail: receiptThumbnail} = receiptPath && receiptFilename ? ReceiptUtils.getThumbnailAndImageURIs(transaction, receiptPath, receiptFilename) : {}; return (