mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +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,
|
name: editVariant.name,
|
||||||
weight: editVariant.weight / 10,
|
weight: editVariant.weight / 10,
|
||||||
weightType: editVariant.weightType || weightTypes.VARIABLE,
|
weightType: editVariant.weightType || weightTypes.VARIABLE,
|
||||||
|
stickiness: editVariant.stickiness
|
||||||
});
|
});
|
||||||
if (editVariant.payload) {
|
if (editVariant.payload) {
|
||||||
setPayload(editVariant.payload);
|
setPayload(editVariant.payload);
|
||||||
@ -100,6 +101,7 @@ const AddVariant = ({
|
|||||||
name: data.name,
|
name: data.name,
|
||||||
weight: data.weight * 10,
|
weight: data.weight * 10,
|
||||||
weightType: data.weightType,
|
weightType: data.weightType,
|
||||||
|
stickiness: data.stickiness,
|
||||||
payload: payload.value ? payload : undefined,
|
payload: payload.value ? payload : undefined,
|
||||||
overrides: overrides
|
overrides: overrides
|
||||||
.map(o => ({
|
.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.
|
By overriding the stickiness you can control which parameter you want to be used in order to ensure consistent traffic allocation across variants.
|
||||||
|
|
||||||
<a
|
<a
|
||||||
href="https://unleash.github.io/docs/toggle_variants"
|
href="https://docs.getunleash.io/advanced/toggle_variants"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
|
@ -129,9 +129,8 @@ class UpdateVariantComponent extends Component {
|
|||||||
you want to be used in order to ensure consistent traffic
|
you want to be used in order to ensure consistent traffic
|
||||||
allocation across variants.{' '}
|
allocation across variants.{' '}
|
||||||
<a
|
<a
|
||||||
href="https://unleash.github.io/docs/toggle_variants"
|
href="https://docs.getunleash.io/advanced/toggle_variants"
|
||||||
target="_blank"
|
target="_blank" rel="noreferrer"
|
||||||
rel="noreferrer"
|
|
||||||
>
|
>
|
||||||
Read more
|
Read more
|
||||||
</a>
|
</a>
|
||||||
|
@ -16,6 +16,9 @@ const mapDispatchToProps = (dispatch, ownProps) => ({
|
|||||||
addVariant: variant => {
|
addVariant: variant => {
|
||||||
const { featureToggle } = ownProps;
|
const { featureToggle } = ownProps;
|
||||||
const currentVariants = featureToggle.variants || [];
|
const currentVariants = featureToggle.variants || [];
|
||||||
|
const stickiness = currentVariants[0].stickiness || 'default';
|
||||||
|
variant.stickiness = stickiness;
|
||||||
|
|
||||||
const variants = [...currentVariants, variant];
|
const variants = [...currentVariants, variant];
|
||||||
updateWeight(variants, 1000);
|
updateWeight(variants, 1000);
|
||||||
return requestUpdateFeatureToggleVariants(
|
return requestUpdateFeatureToggleVariants(
|
||||||
|
Loading…
Reference in New Issue
Block a user