Skip to content

Commit

Permalink
Merge pull request #34012 from tienifr/fix/33388
Browse files Browse the repository at this point in the history
Set default category for distance request
  • Loading branch information
yuwenmemon authored Feb 6, 2024
2 parents be30bae + cbbc7a3 commit a068ac5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/pages/iou/request/step/IOURequestStepConfirmation.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ function IOURequestStepConfirmation({
IOU.setMoneyRequestBillable_temporaryForRefactor(transactionID, defaultBillable);
}, [transactionID, defaultBillable]);

const defaultCategory = lodashGet(
_.find(lodashGet(policy, 'customUnits', {}), (customUnit) => customUnit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE),
'defaultCategory',
'',
);
useEffect(() => {
if (requestType !== CONST.IOU.REQUEST_TYPE.DISTANCE || !_.isEmpty(transaction.category)) {
return;
}
IOU.setMoneyRequestCategory_temporaryForRefactor(transactionID, defaultCategory);
}, [transactionID, transaction.category, requestType, defaultCategory]);

const navigateBack = useCallback(() => {
// If there is not a report attached to the IOU with a reportID, then the participants were manually selected and the user needs taken
// back to the participants step
Expand Down

0 comments on commit a068ac5

Please sign in to comment.