1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: wrong environment name in strategy creation

This commit is contained in:
Youssef 2021-12-07 09:59:16 +01:00
parent f4681a3883
commit 93fb9fb66a
2 changed files with 5 additions and 4 deletions

View File

@ -61,7 +61,7 @@ const FeatureToggleListNewItem = ({
}
};
const handleToggle = (env: IEnvironments, e: SyntheticEvent) => {
const handleToggle = (env: IEnvironments) => {
toggleFeatureByEnvironment(env.name, env.enabled)
.then(() => {
setToastData({
@ -73,7 +73,6 @@ const FeatureToggleListNewItem = ({
})
.catch(e => {
if (e.message === ENVIRONMENT_STRATEGY_ERROR) {
setEnvironmentName(env.name);
setShowInfoBox(true);
} else {
setToastData({
@ -150,7 +149,10 @@ const FeatureToggleListNewItem = ({
projectId={projectId}
permission={UPDATE_FEATURE}
ref={ref}
onClick={handleToggle.bind(this, env)}
onClick={() => {
handleToggle(env);
setEnvironmentName(env.name);
}}
/>
</span>
</TableCell>

View File

@ -62,7 +62,6 @@ const FeatureStrategiesEnvironments = () => {
useEffect(() => {
if (addStrategy) {
setExpandedSidebar(true);
history.replace(history.location.pathname);
}
if (!feature) return;