1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-17 01:17:29 +02: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) toggleFeatureByEnvironment(env.name, env.enabled)
.then(() => { .then(() => {
setToastData({ setToastData({
@ -73,7 +73,6 @@ const FeatureToggleListNewItem = ({
}) })
.catch(e => { .catch(e => {
if (e.message === ENVIRONMENT_STRATEGY_ERROR) { if (e.message === ENVIRONMENT_STRATEGY_ERROR) {
setEnvironmentName(env.name);
setShowInfoBox(true); setShowInfoBox(true);
} else { } else {
setToastData({ setToastData({
@ -150,7 +149,10 @@ const FeatureToggleListNewItem = ({
projectId={projectId} projectId={projectId}
permission={UPDATE_FEATURE} permission={UPDATE_FEATURE}
ref={ref} ref={ref}
onClick={handleToggle.bind(this, env)} onClick={() => {
handleToggle(env);
setEnvironmentName(env.name);
}}
/> />
</span> </span>
</TableCell> </TableCell>

View File

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