fmorg-git commented on code in PR #995:
URL: https://github.com/apache/ranger/pull/995#discussion_r3464043050
##########
security-admin/src/main/webapp/react-webapp/src/views/PolicyListing/PolicyPermissionItem.jsx:
##########
@@ -105,15 +107,53 @@ export default function PolicyPermissionItem(props) {
};
const grpResourcesKeys = useMemo(() => {
- const { resources = [] } = serviceCompDetails;
+ const { resources = [] } = serviceCompDetails || {};
const grpResources = groupBy(resources, "level");
let grpResourcesKeys = [];
for (const resourceKey in grpResources) {
grpResourcesKeys.push(+resourceKey);
}
grpResourcesKeys = grpResourcesKeys.sort();
return grpResourcesKeys;
- }, []);
+ }, [serviceCompDetails?.resources]);
+
+ // Narrow dependency: only recompute when resource selection fields change,
+ // not on every keystroke in user/group/permission fields.
+ const resourceBlocks = Array.isArray(formValues?.additionalResources)
+ ? formValues.additionalResources
+ : [formValues];
+
+ const serializedResources = JSON.stringify(
+ resourceBlocks.map((b) =>
+ grpResourcesKeys.map((level) => b?.[`resourceName-${level}`]?.name ||
null)
+ )
+ );
Review Comment:
updated - 47ac69e22cba9d41f2d6072f01a9989592140210
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]