mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +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
							
								
									9f74007b8b
								
							
						
					
					
						commit
						4bcd73b268
					
				| @ -134,13 +134,13 @@ export const FeatureToggleSwitch: VFC<IFeatureToggleSwitchProps> = ({ | |||||||
|                 onChangeRequestToggle( |                 onChangeRequestToggle( | ||||||
|                     feature.name, |                     feature.name, | ||||||
|                     environmentName, |                     environmentName, | ||||||
|                     !value, |                     !isChecked, | ||||||
|                     false |                     false | ||||||
|                 ); |                 ); | ||||||
|             } |             } | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         if (value) { |         if (isChecked) { | ||||||
|             await handleToggleEnvironmentOff(); |             await handleToggleEnvironmentOff(); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| @ -159,7 +159,12 @@ export const FeatureToggleSwitch: VFC<IFeatureToggleSwitchProps> = ({ | |||||||
|             }, |             }, | ||||||
|         }); |         }); | ||||||
|         if (isChangeRequestConfigured(environmentName)) { |         if (isChangeRequestConfigured(environmentName)) { | ||||||
|             onChangeRequestToggle(feature.name, environmentName, !value, true); |             onChangeRequestToggle( | ||||||
|  |                 feature.name, | ||||||
|  |                 environmentName, | ||||||
|  |                 !isChecked, | ||||||
|  |                 true | ||||||
|  |             ); | ||||||
|         } else { |         } else { | ||||||
|             await handleToggleEnvironmentOn(true); |             await handleToggleEnvironmentOn(true); | ||||||
|         } |         } | ||||||
| @ -173,7 +178,12 @@ export const FeatureToggleSwitch: VFC<IFeatureToggleSwitchProps> = ({ | |||||||
|             }, |             }, | ||||||
|         }); |         }); | ||||||
|         if (isChangeRequestConfigured(environmentName)) { |         if (isChangeRequestConfigured(environmentName)) { | ||||||
|             onChangeRequestToggle(feature.name, environmentName, !value, false); |             onChangeRequestToggle( | ||||||
|  |                 feature.name, | ||||||
|  |                 environmentName, | ||||||
|  |                 !isChecked, | ||||||
|  |                 false | ||||||
|  |             ); | ||||||
|         } else { |         } else { | ||||||
|             await handleToggleEnvironmentOn(); |             await handleToggleEnvironmentOn(); | ||||||
|         } |         } | ||||||
| @ -201,7 +211,7 @@ export const FeatureToggleSwitch: VFC<IFeatureToggleSwitchProps> = ({ | |||||||
|             > |             > | ||||||
|                 <PermissionSwitch |                 <PermissionSwitch | ||||||
|                     tooltip={ |                     tooltip={ | ||||||
|                         value |                         isChecked | ||||||
|                             ? `Disable feature in ${environmentName}` |                             ? `Disable feature in ${environmentName}` | ||||||
|                             : `Enable feature in ${environmentName}` |                             : `Enable feature in ${environmentName}` | ||||||
|                     } |                     } | ||||||
| @ -211,7 +221,6 @@ export const FeatureToggleSwitch: VFC<IFeatureToggleSwitchProps> = ({ | |||||||
|                     permission={UPDATE_FEATURE_ENVIRONMENT} |                     permission={UPDATE_FEATURE_ENVIRONMENT} | ||||||
|                     inputProps={{ 'aria-label': environmentName }} |                     inputProps={{ 'aria-label': environmentName }} | ||||||
|                     onClick={onClick} |                     onClick={onClick} | ||||||
|                     disabled={isChecked !== value} |  | ||||||
|                 /> |                 /> | ||||||
|             </StyledBoxContainer> |             </StyledBoxContainer> | ||||||
|             {showStrategyImprovements && ( |             {showStrategyImprovements && ( | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user