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

View File

@@ -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 }
);