Skip to content

Commit

Permalink
Merge pull request #32888 from mkhutornyi/fix-32872
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins authored Dec 12, 2023
2 parents f454dd1 + 7fa5684 commit 85d61d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ function setMoneyRequestCategory_temporaryForRefactor(transactionID, category) {
Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {category});
}

/*
* @param {String} transactionID
*/
function resetMoneyRequestCategory_temporaryForRefactor(transactionID) {
Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {category: null});
}

/*
* @param {String} transactionID
* @param {String} tag
Expand Down Expand Up @@ -3164,6 +3171,7 @@ export {
startMoneyRequest,
startMoneyRequest_temporaryForRefactor,
resetMoneyRequestCategory,
resetMoneyRequestCategory_temporaryForRefactor,
resetMoneyRequestInfo,
resetMoneyRequestTag,
resetMoneyRequestTag_temporaryForRefactor,
Expand Down
6 changes: 5 additions & 1 deletion src/pages/iou/request/step/IOURequestStepCategory.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ function IOURequestStepCategory({
* @param {String} category.searchText
*/
const updateCategory = (category) => {
IOU.setMoneyRequestCategory_temporaryForRefactor(transactionID, category.searchText);
if (category.searchText === transaction.category) {
IOU.resetMoneyRequestCategory_temporaryForRefactor(transactionID);
} else {
IOU.setMoneyRequestCategory_temporaryForRefactor(transactionID, category.searchText);
}
navigateBack();
};

Expand Down

0 comments on commit 85d61d7

Please sign in to comment.