From 9fa7e69487d235984877e3f7ce5e732dd318725b Mon Sep 17 00:00:00 2001 From: usman-ghani564 Date: Tue, 2 Apr 2024 03:41:25 +0500 Subject: [PATCH 1/3] fix: add iouType to differ with request / split --- .../MoneyTemporaryForRefactorRequestParticipantsSelector.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js index e0a570e334d5..31ddda4cf04d 100644 --- a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js +++ b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js @@ -188,6 +188,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({ { ..._.pick(option, 'accountID', 'login', 'isPolicyExpenseChat', 'reportID', 'searchText'), selected: true, + iouType: iouType, }, ]); onFinish(); @@ -227,6 +228,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({ reportID: option.reportID, selected: true, searchText: option.searchText, + iouType: iouType === CONST.IOU.TYPE.REQUEST ? CONST.IOU.TYPE.SPLIT : iouType, }, ]; } From 6b96af5d0682b771368ba8b7fbcfed6f3acf52b6 Mon Sep 17 00:00:00 2001 From: usman-ghani564 Date: Tue, 2 Apr 2024 04:51:36 +0500 Subject: [PATCH 2/3] fix lint --- .../MoneyTemporaryForRefactorRequestParticipantsSelector.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js index 31ddda4cf04d..bdd71d28b0e0 100644 --- a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js +++ b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js @@ -182,13 +182,14 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({ * * @param {Object} option */ + // eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want to trigger this callback when iouType changes const addSingleParticipant = useCallback( (option) => { onParticipantsAdded([ { ..._.pick(option, 'accountID', 'login', 'isPolicyExpenseChat', 'reportID', 'searchText'), selected: true, - iouType: iouType, + iouType, }, ]); onFinish(); @@ -200,6 +201,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({ * Removes a selected option from list if already selected. If not already selected add this option to the list. * @param {Object} option */ + // eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want to trigger this callback when iouType changes const addParticipantToSelection = useCallback( (option) => { const isOptionSelected = (selectedOption) => { From 4ac2310471c1961d6ab5846f2c2770e197d62a4e Mon Sep 17 00:00:00 2001 From: usman-ghani564 Date: Tue, 2 Apr 2024 05:00:50 +0500 Subject: [PATCH 3/3] fix lint --- .../MoneyTemporaryForRefactorRequestParticipantsSelector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js index bdd71d28b0e0..4870d39002ac 100644 --- a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js +++ b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js @@ -182,7 +182,6 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({ * * @param {Object} option */ - // eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want to trigger this callback when iouType changes const addSingleParticipant = useCallback( (option) => { onParticipantsAdded([ @@ -194,6 +193,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({ ]); onFinish(); }, + // eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want to trigger this callback when iouType changes [onFinish, onParticipantsAdded], ); @@ -201,7 +201,6 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({ * Removes a selected option from list if already selected. If not already selected add this option to the list. * @param {Object} option */ - // eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want to trigger this callback when iouType changes const addParticipantToSelection = useCallback( (option) => { const isOptionSelected = (selectedOption) => { @@ -237,6 +236,7 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({ onParticipantsAdded(newSelectedOptions, newSelectedOptions.length !== 0 ? CONST.IOU.TYPE.SPLIT : undefined); }, + // eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want to trigger this callback when iouType changes [participants, onParticipantsAdded], );