Skip to content

Commit

Permalink
fix: remove tags along with errors
Browse files Browse the repository at this point in the history
  • Loading branch information
allroundexperts committed Mar 15, 2024
1 parent c047c0b commit 861fa37
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2870,7 +2870,6 @@ function createPolicyTag(policyID: string, tagName: string) {
tags: {
[tagName]: {
errors: ErrorUtils.getMicroSecondOnyxError('workspace.tags.genericFailureMessage'),
pendingAction: null,
},
},
},
Expand All @@ -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,
},
},
},
});
Expand Down

0 comments on commit 861fa37

Please sign in to comment.