Skip to content

Commit

Permalink
Fix Request Money - Tag is not being deselected
Browse files Browse the repository at this point in the history
  • Loading branch information
tgolen committed Nov 28, 2023
1 parent f53fa56 commit 0116a1f
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 @@ -213,6 +213,13 @@ function setMoneyRequestTag_temporaryForRefactor(transactionID, tag) {
Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {tag});
}

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

/**
* @param {String} transactionID
* @param {Boolean} billable
Expand Down Expand Up @@ -3158,6 +3165,7 @@ export {
resetMoneyRequestCategory,
resetMoneyRequestInfo,
resetMoneyRequestTag,
resetMoneyRequestTag_temporaryForRefactor,
clearMoneyRequest,
setMoneyRequestAmount_temporaryForRefactor,
setMoneyRequestBillable_temporaryForRefactor,
Expand Down
6 changes: 5 additions & 1 deletion src/pages/iou/request/step/IOURequestStepTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ function IOURequestStepTag({
* @param {String} selectedTag.searchText
*/
const updateTag = (selectedTag) => {
IOU.setMoneyRequestTag_temporaryForRefactor(transactionID, selectedTag.searchText);
if (selectedTag.searchText === tag) {
IOU.resetMoneyRequestTag_temporaryForRefactor(transactionID);
} else {
IOU.setMoneyRequestTag_temporaryForRefactor(transactionID, selectedTag.searchText);
}
navigateBack();
};

Expand Down

0 comments on commit 0116a1f

Please sign in to comment.