mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: variant stickiness should not revert to default when updating (#318)
This commit is contained in:
		
							parent
							
								
									e339e5c01f
								
							
						
					
					
						commit
						f168761c01
					
				@ -46,6 +46,7 @@ const AddVariant = ({
 | 
			
		||||
                name: editVariant.name,
 | 
			
		||||
                weight: editVariant.weight / 10,
 | 
			
		||||
                weightType: editVariant.weightType || weightTypes.VARIABLE,
 | 
			
		||||
                stickiness: editVariant.stickiness
 | 
			
		||||
            });
 | 
			
		||||
            if (editVariant.payload) {
 | 
			
		||||
                setPayload(editVariant.payload);
 | 
			
		||||
@ -100,6 +101,7 @@ const AddVariant = ({
 | 
			
		||||
                name: data.name,
 | 
			
		||||
                weight: data.weight * 10,
 | 
			
		||||
                weightType: data.weightType,
 | 
			
		||||
                stickiness: data.stickiness,
 | 
			
		||||
                payload: payload.value ? payload : undefined,
 | 
			
		||||
                overrides: overrides
 | 
			
		||||
                    .map(o => ({
 | 
			
		||||
 | 
			
		||||
@ -522,7 +522,7 @@ exports[`renders correctly with with variants 1`] = `
 | 
			
		||||
        By overriding the stickiness you can control which parameter you want to be used in order to ensure consistent traffic allocation across variants.
 | 
			
		||||
         
 | 
			
		||||
        <a
 | 
			
		||||
          href="https://unleash.github.io/docs/toggle_variants"
 | 
			
		||||
          href="https://docs.getunleash.io/advanced/toggle_variants"
 | 
			
		||||
          rel="noreferrer"
 | 
			
		||||
          target="_blank"
 | 
			
		||||
        >
 | 
			
		||||
 | 
			
		||||
@ -129,9 +129,8 @@ class UpdateVariantComponent extends Component {
 | 
			
		||||
                    you want to be used in order to ensure consistent traffic
 | 
			
		||||
                    allocation across variants.{' '}
 | 
			
		||||
                    <a
 | 
			
		||||
                        href="https://unleash.github.io/docs/toggle_variants"
 | 
			
		||||
                        target="_blank"
 | 
			
		||||
                        rel="noreferrer"
 | 
			
		||||
                        href="https://docs.getunleash.io/advanced/toggle_variants"
 | 
			
		||||
                        target="_blank" rel="noreferrer"
 | 
			
		||||
                    >
 | 
			
		||||
                        Read more
 | 
			
		||||
                    </a>
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,9 @@ const mapDispatchToProps = (dispatch, ownProps) => ({
 | 
			
		||||
    addVariant: variant => {
 | 
			
		||||
        const { featureToggle } = ownProps;
 | 
			
		||||
        const currentVariants = featureToggle.variants || [];
 | 
			
		||||
        const stickiness = currentVariants[0].stickiness || 'default';
 | 
			
		||||
        variant.stickiness = stickiness;
 | 
			
		||||
        
 | 
			
		||||
        const variants = [...currentVariants, variant];
 | 
			
		||||
        updateWeight(variants, 1000);
 | 
			
		||||
        return requestUpdateFeatureToggleVariants(
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user