diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 7b370e8d2bbf..4ddb138ac962 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -571,7 +571,7 @@ const ROUTES = { }, WORKSPACE_CATEGORY_EDIT: { route: 'workspace/:policyID/categories/:categoryName/edit', - getRoute: (policyID: string, categoryName: string) => `workspace/${policyID}/categories/${encodeURI(categoryName)}/edit` as const, + getRoute: (policyID: string, categoryName: string) => `workspace/${policyID}/categories/${encodeURIComponent(categoryName)}/edit` as const, }, WORKSPACE_TAGS: { route: 'settings/workspaces/:policyID/tags', diff --git a/src/pages/workspace/categories/EditCategoryPage.tsx b/src/pages/workspace/categories/EditCategoryPage.tsx index 35a8648f1a18..23cf2bd103a7 100644 --- a/src/pages/workspace/categories/EditCategoryPage.tsx +++ b/src/pages/workspace/categories/EditCategoryPage.tsx @@ -27,12 +27,13 @@ type EditCategoryPageProps = WorkspaceEditCategoryPageOnyxProps & StackScreenPro function EditCategoryPage({route, policyCategories}: EditCategoryPageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); + const currentCategoryName = decodeURIComponent(route.params.categoryName); const editCategory = useCallback( (values: FormOnyxValues) => { - Policy.renamePolicyCategory(route.params.policyID, {oldName: route.params.categoryName, newName: values.categoryName}); + Policy.renamePolicyCategory(route.params.policyID, {oldName: currentCategoryName, newName: values.categoryName}); }, - [route.params.categoryName, route.params.policyID], + [currentCategoryName, route.params.policyID], ); return ( @@ -50,7 +51,7 @@ function EditCategoryPage({route, policyCategories}: EditCategoryPageProps) { />