1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: variant stickiness should not revert to default when updating (#318)

This commit is contained in:
Ivar Conradi Østhus 2021-07-21 09:04:50 +02:00 committed by GitHub
parent e339e5c01f
commit f168761c01
4 changed files with 8 additions and 4 deletions

View File

@ -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 => ({

View File

@ -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"
>

View File

@ -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>

View File

@ -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(