From 861fa37eaa8be454e0faabce2a7fc382470b92fc Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Fri, 15 Mar 2024 05:12:35 +0500 Subject: [PATCH] fix: remove tags along with errors --- src/libs/actions/Policy.ts | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index 9648fb70179a..1b9aca80c987 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -2870,7 +2870,6 @@ function createPolicyTag(policyID: string, tagName: string) { tags: { [tagName]: { errors: ErrorUtils.getMicroSecondOnyxError('workspace.tags.genericFailureMessage'), - pendingAction: null, }, }, }, @@ -2894,15 +2893,24 @@ function clearPolicyTagErrors(policyID: string, tagName: string) { return; } + if (tag.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { + Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`, { + [tagListName]: { + tags: { + [tagName]: null, + }, + }, + }); + return; + } + Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`, { [tagListName]: { tags: { - [tagName]: - tag.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD - ? null - : { - errors: null, - }, + [tagName]: { + errors: null, + pendingAction: null, + }, }, }, });