mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
1-1315: revalidate feature name whenever the project changes (#4628)
This change makes it so that the flag name is revalidated against the new project pattern whenever you change the target project for a flag. The validation is not run if the name is empty, if there is no pattern, or if there is no validation method. This solves the case where you input a name, then change the project, and where the name isn't valid for the new project. Previously, it wouldn't revalidate, but now it does.
This commit is contained in:
parent
15015f78f3
commit
90395b974b
@ -138,6 +138,13 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
|
|||||||
|
|
||||||
const displayFeatureNamingInfo = Boolean(featureNaming?.pattern);
|
const displayFeatureNamingInfo = Boolean(featureNaming?.pattern);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (featureNaming?.pattern && validateToggleName && name) {
|
||||||
|
clearErrors();
|
||||||
|
validateToggleName();
|
||||||
|
}
|
||||||
|
}, [featureNaming?.pattern]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledForm onSubmit={handleSubmit}>
|
<StyledForm onSubmit={handleSubmit}>
|
||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
|
Loading…
Reference in New Issue
Block a user