diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index c5c6b03f3d44..3cefcd00ed60 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -89,7 +89,9 @@ function resetMoneyRequestInfo(id = '') { amount: 0, currency: lodashGet(currentUserPersonalDetails, 'localCurrencyCode', CONST.CURRENCY.USD), comment: '', + // TODO: remove participants after all instances of iou.participants will be replaced with iou.participantAccountIDs participants: [], + participantAccountIDs: [], merchant: CONST.TRANSACTION.DEFAULT_MERCHANT, category: '', created, @@ -1950,7 +1952,9 @@ function resetMoneyRequestCategory() { * @param {Object[]} participants */ function setMoneyRequestParticipants(participants) { - Onyx.merge(ONYXKEYS.IOU, {participants}); + // TODO: temporarily we want to save both participants and participantAccountIDs, then we can remove participants (and rename the function) + // more info: https://github.com/Expensify/App/issues/25714#issuecomment-1712924903 and https://github.com/Expensify/App/issues/25714#issuecomment-1716335802 + Onyx.merge(ONYXKEYS.IOU, {participants, participantAccountIDs: _.map(participants, 'accountID')}); } /** diff --git a/src/pages/iou/MoneyRequestDatePage.js b/src/pages/iou/MoneyRequestDatePage.js index 428a1a3b4593..68af1a6244b6 100644 --- a/src/pages/iou/MoneyRequestDatePage.js +++ b/src/pages/iou/MoneyRequestDatePage.js @@ -61,10 +61,10 @@ function MoneyRequestDatePage({iou, route, selectedTab}) { IOU.resetMoneyRequestInfo(moneyRequestId); } - if (!isDistanceRequest && (_.isEmpty(iou.participants) || (iou.amount === 0 && !iou.receiptPath) || shouldReset)) { + if (!isDistanceRequest && (_.isEmpty(iou.participantAccountIDs) || (iou.amount === 0 && !iou.receiptPath) || shouldReset)) { Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); } - }, [iou.id, iou.participants, iou.amount, iou.receiptPath, iouType, reportID, isDistanceRequest]); + }, [iou.id, iou.participantAccountIDs, iou.amount, iou.receiptPath, iouType, reportID, isDistanceRequest]); function navigateBack() { Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js index 0678088073d3..63aea67ce598 100644 --- a/src/pages/iou/MoneyRequestDescriptionPage.js +++ b/src/pages/iou/MoneyRequestDescriptionPage.js @@ -65,10 +65,10 @@ function MoneyRequestDescriptionPage({iou, route, selectedTab}) { IOU.resetMoneyRequestInfo(moneyRequestId); } - if (!isDistanceRequest && (_.isEmpty(iou.participants) || (iou.amount === 0 && !iou.receiptPath) || shouldReset)) { + if (!isDistanceRequest && (_.isEmpty(iou.participantAccountIDs) || (iou.amount === 0 && !iou.receiptPath) || shouldReset)) { Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); } - }, [iou.id, iou.participants, iou.amount, iou.receiptPath, iouType, reportID, isDistanceRequest]); + }, [iou.id, iou.participantAccountIDs, iou.amount, iou.receiptPath, iouType, reportID, isDistanceRequest]); function navigateBack() { Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); diff --git a/src/pages/iou/MoneyRequestMerchantPage.js b/src/pages/iou/MoneyRequestMerchantPage.js index 9a49b0259bd2..f8ae810eafba 100644 --- a/src/pages/iou/MoneyRequestMerchantPage.js +++ b/src/pages/iou/MoneyRequestMerchantPage.js @@ -58,10 +58,10 @@ function MoneyRequestMerchantPage({iou, route}) { IOU.resetMoneyRequestInfo(moneyRequestId); } - if (_.isEmpty(iou.participants) || (iou.amount === 0 && !iou.receiptPath) || shouldReset) { + if (_.isEmpty(iou.participantAccountIDs) || (iou.amount === 0 && !iou.receiptPath) || shouldReset) { Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); } - }, [iou.id, iou.participants, iou.amount, iou.receiptPath, iouType, reportID]); + }, [iou.id, iou.participantAccountIDs, iou.amount, iou.receiptPath, iouType, reportID]); function navigateBack() { Navigation.goBack(ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID)); diff --git a/src/pages/iou/steps/NewRequestAmountPage.js b/src/pages/iou/steps/NewRequestAmountPage.js index 0179c211ee55..6712a8c7cd81 100644 --- a/src/pages/iou/steps/NewRequestAmountPage.js +++ b/src/pages/iou/steps/NewRequestAmountPage.js @@ -115,7 +115,7 @@ function NewRequestAmountPage({route, iou, report, selectedTab}) { IOU.resetMoneyRequestInfo(moneyRequestID); } - if (!isDistanceRequestTab && (_.isEmpty(iou.participants) || iou.amount === 0 || shouldReset)) { + if (!isDistanceRequestTab && (_.isEmpty(iou.participantAccountIDs) || iou.amount === 0 || shouldReset)) { Navigation.goBack(ROUTES.getMoneyRequestRoute(iouType, reportID), true); } } @@ -123,7 +123,7 @@ function NewRequestAmountPage({route, iou, report, selectedTab}) { return () => { prevMoneyRequestID.current = iou.id; }; - }, [iou.participants, iou.amount, iou.id, isEditing, iouType, reportID, isDistanceRequestTab]); + }, [iou.participantAccountIDs, iou.amount, iou.id, isEditing, iouType, reportID, isDistanceRequestTab]); const navigateBack = () => { Navigation.goBack(isEditing ? ROUTES.getMoneyRequestConfirmationRoute(iouType, reportID) : null);