From b6a957a30d401153c241a2ad04fdcc3a068b34fe Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Wed, 7 May 2025 15:34:34 -0700 Subject: [PATCH] fix: select all apply to filtered policies only, skip replacing existing policies --- .../RoleDetailsBySlugPage/components/PolicySelectionModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx index ec272676e..e636bdfe4 100644 --- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx +++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx @@ -86,7 +86,7 @@ const Content = ({ onClose }: ContentProps) => { [...rootPolicyValue, {}], { shouldDirty: true, shouldTouch: true } ); - } else { + } else if (!rootPolicyValue?.length) { rootForm.setValue( `permissions.${type}`, // eslint-disable-next-line @typescript-eslint/ban-ts-comment @@ -130,7 +130,7 @@ const Content = ({ onClose }: ContentProps) => { setValue( "permissions", Object.fromEntries( - Object.values(ProjectPermissionSub).map((subject) => [subject, true]) + filteredPolicies.map((subject) => [subject, true]) ) as TForm["permissions"], { shouldDirty: true } );