fix: select all apply to filtered policies only, skip replacing existing policies

This commit is contained in:
Scott Wilson
2025-05-07 15:34:34 -07:00
parent 16c476d78c
commit b6a957a30d
@@ -86,7 +86,7 @@ const Content = ({ onClose }: ContentProps) => {
[...rootPolicyValue, {}], [...rootPolicyValue, {}],
{ shouldDirty: true, shouldTouch: true } { shouldDirty: true, shouldTouch: true }
); );
} else { } else if (!rootPolicyValue?.length) {
rootForm.setValue( rootForm.setValue(
`permissions.${type}`, `permissions.${type}`,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -130,7 +130,7 @@ const Content = ({ onClose }: ContentProps) => {
setValue( setValue(
"permissions", "permissions",
Object.fromEntries( Object.fromEntries(
Object.values(ProjectPermissionSub).map((subject) => [subject, true]) filteredPolicies.map((subject) => [subject, true])
) as TForm["permissions"], ) as TForm["permissions"],
{ shouldDirty: true } { shouldDirty: true }
); );