Skip to content

Commit

Permalink
[Cloud Security][BUG] Uneditable policy name field (elastic#159905)
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanSh authored Jun 19, 2023
1 parent c191104 commit 03392dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ const useEnsureDefaultNamespace = ({
updatePolicy(policy);
}, [newPolicy, input, updatePolicy]);
};

const usePolicyTemplateInitialName = ({
isEditPage,
isLoading,
Expand Down Expand Up @@ -286,11 +287,14 @@ const usePolicyTemplateInitialName = ({
if (newPolicy.name === currentIntegrationName) {
return;
}

updatePolicy({
...newPolicy,
name: currentIntegrationName,
});
}, [isLoading, integration, isEditPage, packagePolicyList, newPolicy, updatePolicy]);
// since this useEffect should only run on initial mount updatePolicy and newPolicy shouldn't re-trigger it
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isLoading, integration, isEditPage, packagePolicyList]);
};

const getSelectedOption = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const getMaxPackageName = (
packageName: string,
packagePolicies?: Array<{ name: string }>
) => {
// Retrieve highest number appended to package policy name and increment it by one
// Retrieve the highest number appended to package policy name and increment it by one
const pkgPoliciesNamePattern = new RegExp(`${packageName}-(\\d+)`);

const maxPkgPolicyName = Math.max(
Expand Down

0 comments on commit 03392dd

Please sign in to comment.