Skip to content

Commit

Permalink
update params
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Feb 28, 2024
1 parent b4cc17f commit 07ebdf0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,13 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({
* @param {Object} option
*/
const addSingleParticipant = (option) => {
onParticipantsAdded(
[
{
..._.pick(option, 'accountID', 'login', 'isPolicyExpenseChat', 'reportID', 'searchText'),
selected: true,
},
],
false,
);
onFinish(false);
onParticipantsAdded([
{
..._.pick(option, 'accountID', 'login', 'isPolicyExpenseChat', 'reportID', 'searchText'),
selected: true,
},
]);
onFinish();
};

/**
Expand Down Expand Up @@ -237,7 +234,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({
];
}

onParticipantsAdded(newSelectedOptions, newSelectedOptions.length !== 0);
onParticipantsAdded(newSelectedOptions, newSelectedOptions.length !== 0 ? CONST.IOU.TYPE.SPLIT : undefined);
},
[participants, onParticipantsAdded],
);
Expand Down Expand Up @@ -266,7 +263,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({
return;
}

onFinish(true);
onFinish(CONST.IOU.TYPE.SPLIT);
}, [shouldShowSplitBillErrorMessage, onFinish]);

const footerContent = useMemo(
Expand Down
6 changes: 4 additions & 2 deletions src/pages/iou/request/step/IOURequestStepParticipants.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ function IOURequestStepParticipants({
}, [participants, updateRouteParams]);

const addParticipant = useCallback(
(val, isSplit) => {
(val, selectedIouType) => {
const isSplit = selectedIouType === CONST.IOU.TYPE.SPLIT;
// It's only possible to switch between REQUEST and SPLIT.
// We want to update the IOU type only if it's not updated yet to prevent unnecessary updates.
if (isSplit && iouType !== CONST.IOU.TYPE.SPLIT) {
Expand Down Expand Up @@ -106,7 +107,8 @@ function IOURequestStepParticipants({
);

const goToNextStep = useCallback(
(isSplit) => {
(selectedIouType) => {
const isSplit = selectedIouType === CONST.IOU.TYPE.SPLIT;
const nextStepIOUType = !isSplit && iouType !== CONST.IOU.TYPE.REQUEST ? CONST.IOU.TYPE.REQUEST : iouType;
IOU.setMoneyRequestTag(transactionID, '');
IOU.setMoneyRequestCategory(transactionID, '');
Expand Down

0 comments on commit 07ebdf0

Please sign in to comment.