diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 0f255aec47b2..f286be99b047 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -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 @@ -3158,6 +3165,7 @@ export { resetMoneyRequestCategory, resetMoneyRequestInfo, resetMoneyRequestTag, + resetMoneyRequestTag_temporaryForRefactor, clearMoneyRequest, setMoneyRequestAmount_temporaryForRefactor, setMoneyRequestBillable_temporaryForRefactor, diff --git a/src/pages/iou/request/step/IOURequestStepTag.js b/src/pages/iou/request/step/IOURequestStepTag.js index f2f4d8df251b..41b6dbb367cf 100644 --- a/src/pages/iou/request/step/IOURequestStepTag.js +++ b/src/pages/iou/request/step/IOURequestStepTag.js @@ -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(); };