From 5112fcd257b8bacb005fbdf36ba4a44c0578a30d Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Mon, 3 Jun 2024 12:23:43 -0500 Subject: [PATCH 01/16] fix: add additional parameter --- src/libs/API/parameters/RenamePolicyTaglist.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/API/parameters/RenamePolicyTaglist.ts b/src/libs/API/parameters/RenamePolicyTaglist.ts index 8c92c99aa7fb..ebe9e7db6dba 100644 --- a/src/libs/API/parameters/RenamePolicyTaglist.ts +++ b/src/libs/API/parameters/RenamePolicyTaglist.ts @@ -2,6 +2,7 @@ type RenamePolicyTaglist = { policyID: string; oldName: string; newName: string; + tagListIndex?: number; }; export default RenamePolicyTaglist; From 543998d2632cee232d61afdd74beb265e184d479 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Mon, 3 Jun 2024 12:25:21 -0500 Subject: [PATCH 02/16] fix: pass tagListIndex --- src/libs/actions/Policy/Tag.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index 7760f29d6703..237211f532a7 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -482,7 +482,7 @@ function enablePolicyTags(policyID: string, enabled: boolean) { } } -function renamePolicyTaglist(policyID: string, policyTagListName: {oldName: string; newName: string}, policyTags: OnyxEntry) { +function renamePolicyTaglist(policyID: string, policyTagListName: {oldName: string; newName: string}, policyTags: OnyxEntry, tagListIndex?: number) { const newName = policyTagListName.newName; const oldName = policyTagListName.oldName; const oldPolicyTags = policyTags?.[oldName] ?? {}; @@ -526,6 +526,7 @@ function renamePolicyTaglist(policyID: string, policyTagListName: {oldName: stri policyID, oldName, newName, + tagListIndex, }; API.write(WRITE_COMMANDS.RENAME_POLICY_TAG_LIST, parameters, onyxData); From 979bfc33dea00822e9405ee0ad7157612869d95f Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Mon, 3 Jun 2024 12:26:00 -0500 Subject: [PATCH 03/16] modify renamePolicyTag --- src/libs/actions/Policy/Tag.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index 237211f532a7..067d9c93b30c 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -359,22 +359,22 @@ function clearPolicyTagErrors(policyID: string, tagName: string) { }); } -function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: string}) { - const tagListName = Object.keys(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`] ?? {})[0]; +function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: string}, tagListIndex: number) { + const tagList = PolicyUtils.getTagLists(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`] ?? {})?.[tagListIndex] ?? {}; + const oldTagName = policyTag.oldName; const newTagName = PolicyUtils.escapeTagName(policyTag.newName); - const oldTag = allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`]?.[tagListName]?.tags?.[oldTagName] ?? {}; const onyxData: OnyxData = { optimisticData: [ { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`, value: { - [tagListName]: { + [tagList.name]: { tags: { [oldTagName]: null, [newTagName]: { - ...oldTag, + ...tagList, name: newTagName, pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, pendingFields: { @@ -392,7 +392,7 @@ function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`, value: { - [tagListName]: { + [tagList.name]: { tags: { [newTagName]: { errors: null, @@ -411,11 +411,11 @@ function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`, value: { - [tagListName]: { + [tagList.name]: { tags: { [newTagName]: null, [oldTagName]: { - ...oldTag, + ...tagList, errors: ErrorUtils.getMicroSecondOnyxError('workspace.tags.genericFailureMessage'), }, }, From a4204fbdd13f7b5331bd18101e5caf199af546ea Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Mon, 3 Jun 2024 12:26:26 -0500 Subject: [PATCH 04/16] fix: pass orderWeight --- src/pages/workspace/tags/EditTagPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/tags/EditTagPage.tsx b/src/pages/workspace/tags/EditTagPage.tsx index a6b3b5dd6657..06f8f5853aa5 100644 --- a/src/pages/workspace/tags/EditTagPage.tsx +++ b/src/pages/workspace/tags/EditTagPage.tsx @@ -58,12 +58,12 @@ function EditTagPage({route, policyTags}: EditTagPageProps) { const tagName = values.tagName.trim(); // Do not call the API if the edited tag name is the same as the current tag name if (currentTagName !== tagName) { - Tag.renamePolicyTag(route.params.policyID, {oldName: route.params.tagName, newName: values.tagName.trim()}); + Tag.renamePolicyTag(route.params.policyID, {oldName: route.params.tagName, newName: values.tagName.trim()}, route.params.orderWeight); } Keyboard.dismiss(); Navigation.goBack(); }, - [route.params.policyID, route.params.tagName, currentTagName], + [currentTagName, route.params.policyID, route.params.tagName, route.params.orderWeight], ); return ( From 1284facaa2f3de3bed622f7032d346eef62583a8 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Mon, 3 Jun 2024 12:48:28 -0500 Subject: [PATCH 05/16] fix: get individual tag --- src/libs/actions/Policy/Tag.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index 067d9c93b30c..2ddd5f2665d5 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -361,6 +361,7 @@ function clearPolicyTagErrors(policyID: string, tagName: string) { function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: string}, tagListIndex: number) { const tagList = PolicyUtils.getTagLists(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`] ?? {})?.[tagListIndex] ?? {}; + const tag = tagList.tags?.[policyTag.oldName]; const oldTagName = policyTag.oldName; const newTagName = PolicyUtils.escapeTagName(policyTag.newName); @@ -374,7 +375,7 @@ function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: tags: { [oldTagName]: null, [newTagName]: { - ...tagList, + ...tag, name: newTagName, pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, pendingFields: { @@ -415,7 +416,7 @@ function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: tags: { [newTagName]: null, [oldTagName]: { - ...tagList, + ...tag, errors: ErrorUtils.getMicroSecondOnyxError('workspace.tags.genericFailureMessage'), }, }, From 462253bacbd241530b8979b80fe629516703bc85 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Mon, 3 Jun 2024 15:47:08 -0500 Subject: [PATCH 06/16] chore: clear fields & move errors clearing location --- src/libs/actions/Policy/Tag.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index 2ddd5f2665d5..725a59011681 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -382,6 +382,7 @@ function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: name: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE, }, previousTagName: oldTagName, + errors: null, }, }, }, @@ -396,7 +397,6 @@ function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: [tagList.name]: { tags: { [newTagName]: { - errors: null, pendingAction: null, pendingFields: { name: null, @@ -417,6 +417,8 @@ function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: [newTagName]: null, [oldTagName]: { ...tag, + pendingAction: null, + pendingFields: null, errors: ErrorUtils.getMicroSecondOnyxError('workspace.tags.genericFailureMessage'), }, }, From eacbbb15750ee40b0a401ca534ba7fa8792ce4c5 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Tue, 4 Jun 2024 23:22:01 -0700 Subject: [PATCH 07/16] clear specific pending field Co-authored-by: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> --- src/libs/actions/Policy/Tag.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index 725a59011681..244a3362b628 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -418,7 +418,9 @@ function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: [oldTagName]: { ...tag, pendingAction: null, - pendingFields: null, + pendingFields: { + name: null, + }, errors: ErrorUtils.getMicroSecondOnyxError('workspace.tags.genericFailureMessage'), }, }, From e59c007f9db57004051beb2da5c957093b0aa8b2 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Wed, 5 Jun 2024 02:22:17 -0500 Subject: [PATCH 08/16] pass tag list index --- .../API/parameters/RenamePolicyTagsParams.ts | 1 + src/libs/actions/Policy/Tag.ts | 1 + tests/actions/PolicyTagTest.ts | 24 ++++++++++++------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/libs/API/parameters/RenamePolicyTagsParams.ts b/src/libs/API/parameters/RenamePolicyTagsParams.ts index bcf38384cf2c..6a384623d91f 100644 --- a/src/libs/API/parameters/RenamePolicyTagsParams.ts +++ b/src/libs/API/parameters/RenamePolicyTagsParams.ts @@ -2,6 +2,7 @@ type RenamePolicyTagsParams = { policyID: string; oldName: string; newName: string; + tagListIndex: number; }; export default RenamePolicyTagsParams; diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index 244a3362b628..2099526bbd5e 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -434,6 +434,7 @@ function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: policyID, oldName: oldTagName, newName: newTagName, + tagListIndex, }; API.write(WRITE_COMMANDS.RENAME_POLICY_TAG, parameters, onyxData); diff --git a/tests/actions/PolicyTagTest.ts b/tests/actions/PolicyTagTest.ts index ad473633d876..984e442fbc0b 100644 --- a/tests/actions/PolicyTagTest.ts +++ b/tests/actions/PolicyTagTest.ts @@ -514,10 +514,14 @@ describe('actions/Policy', () => { Onyx.set(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${fakePolicy.id}`, fakePolicyTags); }) .then(() => { - Tag.renamePolicyTag(fakePolicy.id, { - oldName: oldTagName, - newName: newTagName, - }); + Tag.renamePolicyTag( + fakePolicy.id, + { + oldName: oldTagName, + newName: newTagName, + }, + 0, + ); return waitForBatchedUpdates(); }) .then( @@ -580,10 +584,14 @@ describe('actions/Policy', () => { .then(() => { mockFetch?.fail?.(); - Tag.renamePolicyTag(fakePolicy.id, { - oldName: oldTagName, - newName: newTagName, - }); + Tag.renamePolicyTag( + fakePolicy.id, + { + oldName: oldTagName, + newName: newTagName, + }, + 0, + ); return waitForBatchedUpdates(); }) .then(mockFetch?.resume) From 11469a33e086f51ac077ab57f317177e6ae5027b Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Wed, 5 Jun 2024 15:34:20 -0500 Subject: [PATCH 09/16] fix: make api command parameter required --- src/libs/API/parameters/RenamePolicyTaglist.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/API/parameters/RenamePolicyTaglist.ts b/src/libs/API/parameters/RenamePolicyTaglist.ts index ebe9e7db6dba..78776ee8f3ea 100644 --- a/src/libs/API/parameters/RenamePolicyTaglist.ts +++ b/src/libs/API/parameters/RenamePolicyTaglist.ts @@ -2,7 +2,7 @@ type RenamePolicyTaglist = { policyID: string; oldName: string; newName: string; - tagListIndex?: number; + tagListIndex: number; }; export default RenamePolicyTaglist; From 4667251c4291efdcee1e1cef754b73a8df0453e5 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Wed, 5 Jun 2024 15:34:37 -0500 Subject: [PATCH 10/16] fix: make function parameter required --- src/libs/actions/Policy/Tag.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index 2099526bbd5e..732c0f54d05c 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -488,7 +488,7 @@ function enablePolicyTags(policyID: string, enabled: boolean) { } } -function renamePolicyTaglist(policyID: string, policyTagListName: {oldName: string; newName: string}, policyTags: OnyxEntry, tagListIndex?: number) { +function renamePolicyTaglist(policyID: string, policyTagListName: {oldName: string; newName: string}, policyTags: OnyxEntry, tagListIndex: number) { const newName = policyTagListName.newName; const oldName = policyTagListName.oldName; const oldPolicyTags = policyTags?.[oldName] ?? {}; From 12a234c801e334d36a5d06f2a14bfb8f95868f10 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Wed, 5 Jun 2024 15:34:54 -0500 Subject: [PATCH 11/16] fix: pass orderWeight (index) to the function --- src/pages/workspace/tags/WorkspaceEditTagsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx b/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx index f0b3ada7f2e5..46f122a0ed88 100644 --- a/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx @@ -47,7 +47,7 @@ function WorkspaceEditTagsPage({route, policyTags}: WorkspaceEditTagsPageProps) const updateTaglistName = useCallback( (values: FormOnyxValues) => { if (values[INPUT_IDS.POLICY_TAGS_NAME] !== taglistName) { - Tag.renamePolicyTaglist(route.params.policyID, {oldName: taglistName, newName: values[INPUT_IDS.POLICY_TAGS_NAME]}, policyTags); + Tag.renamePolicyTaglist(route.params.policyID, {oldName: taglistName, newName: values[INPUT_IDS.POLICY_TAGS_NAME]}, policyTags, route.params.orderWeight); } Navigation.goBack(); }, From 44334ff513235cc714a578bcee7d54a9083f4623 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Wed, 5 Jun 2024 15:35:34 -0500 Subject: [PATCH 12/16] chore: pass index in the tests --- tests/actions/PolicyTagTest.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/actions/PolicyTagTest.ts b/tests/actions/PolicyTagTest.ts index 984e442fbc0b..24ea7fb4504f 100644 --- a/tests/actions/PolicyTagTest.ts +++ b/tests/actions/PolicyTagTest.ts @@ -177,6 +177,7 @@ describe('actions/Policy', () => { newName: newTagListName, }, fakePolicyTags, + Object.values(fakePolicyTags)[0].orderWeight, ); return waitForBatchedUpdates(); }) @@ -244,6 +245,7 @@ describe('actions/Policy', () => { newName: newTagListName, }, fakePolicyTags, + Object.values(fakePolicyTags)[0].orderWeight, ); return waitForBatchedUpdates(); }) From 9f71d254e32840c2265dd03a5da4d49aae167480 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Wed, 5 Jun 2024 16:10:45 -0500 Subject: [PATCH 13/16] chore: add a missing dependency --- src/pages/workspace/tags/WorkspaceEditTagsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx b/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx index 46f122a0ed88..6adf42c2376b 100644 --- a/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceEditTagsPage.tsx @@ -51,7 +51,7 @@ function WorkspaceEditTagsPage({route, policyTags}: WorkspaceEditTagsPageProps) } Navigation.goBack(); }, - [policyTags, route.params.policyID, taglistName], + [policyTags, route.params.orderWeight, route.params.policyID, taglistName], ); return ( From 08f85ef98bb25b663724db371196c581d8be348c Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Thu, 6 Jun 2024 09:55:12 -0500 Subject: [PATCH 14/16] chore: add param type when specifying the parameter --- 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 732c0f54d05c..d5c65c508fb3 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -1,7 +1,7 @@ import type {NullishDeep, OnyxCollection, OnyxEntry} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import * as API from '@libs/API'; -import type {EnablePolicyTagsParams, OpenPolicyTagsPageParams, SetPolicyTagsEnabled} from '@libs/API/parameters'; +import type {EnablePolicyTagsParams, OpenPolicyTagsPageParams, RenamePolicyTagsParams, SetPolicyTagsEnabled} from '@libs/API/parameters'; import {READ_COMMANDS, WRITE_COMMANDS} from '@libs/API/types'; import * as ErrorUtils from '@libs/ErrorUtils'; import getIsNarrowLayout from '@libs/getIsNarrowLayout'; @@ -430,7 +430,7 @@ function renamePolicyTag(policyID: string, policyTag: {oldName: string; newName: ], }; - const parameters = { + const parameters: RenamePolicyTagsParams = { policyID, oldName: oldTagName, newName: newTagName, From c7f6093369a3d649dc18c3c9bf43fee1f4b07f69 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Thu, 6 Jun 2024 09:59:10 -0500 Subject: [PATCH 15/16] refactor: rename file and type name --- .../{RenamePolicyTaglist.ts => RenamePolicyTaglistParams.ts} | 4 ++-- src/libs/API/parameters/index.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/libs/API/parameters/{RenamePolicyTaglist.ts => RenamePolicyTaglistParams.ts} (54%) diff --git a/src/libs/API/parameters/RenamePolicyTaglist.ts b/src/libs/API/parameters/RenamePolicyTaglistParams.ts similarity index 54% rename from src/libs/API/parameters/RenamePolicyTaglist.ts rename to src/libs/API/parameters/RenamePolicyTaglistParams.ts index 78776ee8f3ea..dd7d08209d32 100644 --- a/src/libs/API/parameters/RenamePolicyTaglist.ts +++ b/src/libs/API/parameters/RenamePolicyTaglistParams.ts @@ -1,8 +1,8 @@ -type RenamePolicyTaglist = { +type RenamePolicyTaglistParams = { policyID: string; oldName: string; newName: string; tagListIndex: number; }; -export default RenamePolicyTaglist; +export default RenamePolicyTaglistParams; diff --git a/src/libs/API/parameters/index.ts b/src/libs/API/parameters/index.ts index 68097a201120..d040104b8031 100644 --- a/src/libs/API/parameters/index.ts +++ b/src/libs/API/parameters/index.ts @@ -172,7 +172,7 @@ export type {default as SetWorkspaceApprovalModeParams} from './SetWorkspaceAppr export type {default as SetWorkspacePayerParams} from './SetWorkspacePayerParams'; export type {default as SetWorkspaceReimbursementParams} from './SetWorkspaceReimbursementParams'; export type {default as SetPolicyRequiresTag} from './SetPolicyRequiresTag'; -export type {default as RenamePolicyTaglist} from './RenamePolicyTaglist'; +export type {default as RenamePolicyTaglistParams} from './RenamePolicyTaglistParams'; export type {default as SwitchToOldDotParams} from './SwitchToOldDotParams'; export type {default as TrackExpenseParams} from './TrackExpenseParams'; export type {default as EnablePolicyCategoriesParams} from './EnablePolicyCategoriesParams'; From 5d728f3e61df2ab71c445d7b81edd0ae22bb1800 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Thu, 6 Jun 2024 10:01:12 -0500 Subject: [PATCH 16/16] refactor: update the existing code to use the new file and type names --- src/libs/API/types.ts | 2 +- src/libs/actions/Policy/Tag.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index 897b300f0471..1c1009bbcede 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -339,7 +339,7 @@ type WriteCommandParameters = { [WRITE_COMMANDS.SET_WORKSPACE_REQUIRES_CATEGORY]: Parameters.SetWorkspaceRequiresCategoryParams; [WRITE_COMMANDS.DELETE_WORKSPACE_CATEGORIES]: Parameters.DeleteWorkspaceCategoriesParams; [WRITE_COMMANDS.SET_POLICY_REQUIRES_TAG]: Parameters.SetPolicyRequiresTag; - [WRITE_COMMANDS.RENAME_POLICY_TAG_LIST]: Parameters.RenamePolicyTaglist; + [WRITE_COMMANDS.RENAME_POLICY_TAG_LIST]: Parameters.RenamePolicyTaglistParams; [WRITE_COMMANDS.CREATE_POLICY_TAG]: Parameters.CreatePolicyTagsParams; [WRITE_COMMANDS.RENAME_POLICY_TAG]: Parameters.RenamePolicyTagsParams; [WRITE_COMMANDS.SET_POLICY_TAGS_ENABLED]: Parameters.SetPolicyTagsEnabled; diff --git a/src/libs/actions/Policy/Tag.ts b/src/libs/actions/Policy/Tag.ts index d5c65c508fb3..b4e86f3ca3bb 100644 --- a/src/libs/actions/Policy/Tag.ts +++ b/src/libs/actions/Policy/Tag.ts @@ -1,7 +1,7 @@ import type {NullishDeep, OnyxCollection, OnyxEntry} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import * as API from '@libs/API'; -import type {EnablePolicyTagsParams, OpenPolicyTagsPageParams, RenamePolicyTagsParams, SetPolicyTagsEnabled} from '@libs/API/parameters'; +import type {EnablePolicyTagsParams, OpenPolicyTagsPageParams, RenamePolicyTaglistParams, RenamePolicyTagsParams, SetPolicyTagsEnabled} from '@libs/API/parameters'; import {READ_COMMANDS, WRITE_COMMANDS} from '@libs/API/types'; import * as ErrorUtils from '@libs/ErrorUtils'; import getIsNarrowLayout from '@libs/getIsNarrowLayout'; @@ -528,7 +528,7 @@ function renamePolicyTaglist(policyID: string, policyTagListName: {oldName: stri }, ], }; - const parameters = { + const parameters: RenamePolicyTaglistParams = { policyID, oldName, newName,