From 0116a1f6f2abc9a4196e8507d139b8dbde63f28f Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Tue, 28 Nov 2023 14:53:02 -0700 Subject: [PATCH] Fix Request Money - Tag is not being deselected --- src/libs/actions/IOU.js | 8 ++++++++ src/pages/iou/request/step/IOURequestStepTag.js | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) 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(); };