mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
Fix: laggy toggles (#3873)
This PR removes the `disabled` state for the feature toggle env switches. This is what causes the lag from when you toggle the switch to when it becomes available for actions again. Signed-off-by: andreas-unleash <andreas@getunleash.ai> Co-authored-by: Nuno Góis <github@nunogois.com>
This commit is contained in:
parent
c7d8c9fd25
commit
89df3f364e
@ -134,13 +134,13 @@ export const FeatureToggleSwitch: VFC<IFeatureToggleSwitchProps> = ({
|
||||
onChangeRequestToggle(
|
||||
feature.name,
|
||||
environmentName,
|
||||
!value,
|
||||
!isChecked,
|
||||
false
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (value) {
|
||||
if (isChecked) {
|
||||
await handleToggleEnvironmentOff();
|
||||
return;
|
||||
}
|
||||
@ -159,7 +159,12 @@ export const FeatureToggleSwitch: VFC<IFeatureToggleSwitchProps> = ({
|
||||
},
|
||||
});
|
||||
if (isChangeRequestConfigured(environmentName)) {
|
||||
onChangeRequestToggle(feature.name, environmentName, !value, true);
|
||||
onChangeRequestToggle(
|
||||
feature.name,
|
||||
environmentName,
|
||||
!isChecked,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
await handleToggleEnvironmentOn(true);
|
||||
}
|
||||
@ -173,7 +178,12 @@ export const FeatureToggleSwitch: VFC<IFeatureToggleSwitchProps> = ({
|
||||
},
|
||||
});
|
||||
if (isChangeRequestConfigured(environmentName)) {
|
||||
onChangeRequestToggle(feature.name, environmentName, !value, false);
|
||||
onChangeRequestToggle(
|
||||
feature.name,
|
||||
environmentName,
|
||||
!isChecked,
|
||||
false
|
||||
);
|
||||
} else {
|
||||
await handleToggleEnvironmentOn();
|
||||
}
|
||||
@ -201,7 +211,7 @@ export const FeatureToggleSwitch: VFC<IFeatureToggleSwitchProps> = ({
|
||||
>
|
||||
<PermissionSwitch
|
||||
tooltip={
|
||||
value
|
||||
isChecked
|
||||
? `Disable feature in ${environmentName}`
|
||||
: `Enable feature in ${environmentName}`
|
||||
}
|
||||
@ -211,7 +221,6 @@ export const FeatureToggleSwitch: VFC<IFeatureToggleSwitchProps> = ({
|
||||
permission={UPDATE_FEATURE_ENVIRONMENT}
|
||||
inputProps={{ 'aria-label': environmentName }}
|
||||
onClick={onClick}
|
||||
disabled={isChecked !== value}
|
||||
/>
|
||||
</StyledBoxContainer>
|
||||
{showStrategyImprovements && (
|
||||
|
Loading…
Reference in New Issue
Block a user