From 65076a7327b1862e3bc1928da5b2c639975171c9 Mon Sep 17 00:00:00 2001 From: gijoe0295 Date: Thu, 1 Aug 2024 01:14:02 +0700 Subject: [PATCH] fix: set gl code and clear errors for depedant tags list not work --- src/libs/actions/Policy/Tag.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index 92496db6fe61..e09454944932 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -349,7 +349,7 @@ function deletePolicyTags(policyID: string, tagsToDelete: string[]) { } function clearPolicyTagErrors(policyID: string, tagName: string, tagListIndex: number) { - const tagListName = Object.keys(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`] ?? {})[tagListIndex]; + const tagListName = PolicyUtils.getTagListName(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`], tagListIndex); const tag = allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`]?.[tagListName].tags?.[tagName]; if (!tag) { return; @@ -772,7 +772,7 @@ function setPolicyTagsRequired(policyID: string, requiresTag: boolean, tagListIn } function setPolicyTagGLCode(policyID: string, tagName: string, tagListIndex: number, glCode: string) { - const tagListName = Object.keys(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`] ?? {})[tagListIndex]; + const tagListName = PolicyUtils.getTagListName(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`], tagListIndex); const policyTagToUpdate = allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`]?.[tagListName]?.tags?.[tagName] ?? {}; const onyxData: OnyxData = { optimisticData: [