in experimenter/experimenter/nimbus-ui/src/components/PageEditBranches/FormBranches/reducer/actions.ts [158:235]
value: extractFeatureValue(
featureConfigId!.toString(),
treatmentBranch,
),
})),
})) as AnnotatedBranch[],
};
}
type SetwarnFeatureSchemaAction = {
type: "setwarnFeatureSchema";
value: FormBranchesState["warnFeatureSchema"];
};
type SetIsLocalizedAction = {
type: "setIsLocalized";
value: FormBranchesState["isLocalized"];
};
function setIsLocalized(
state: FormBranchesState,
{ value: isLocalized }: SetIsLocalizedAction,
) {
return {
...state,
isLocalized,
localizations: isLocalized ? state.localizations ?? "" : null,
};
}
type SetIsRolloutAction = {
type: "setIsRollout";
value: FormBranchesState["isRollout"];
};
function setIsRollout(
state: FormBranchesState,
{ value: isRollout }: SetIsRolloutAction,
) {
let { treatmentBranches } = state;
if (isRollout) {
treatmentBranches = [];
}
return {
...state,
isRollout,
treatmentBranches,
};
}
function setwarnFeatureSchema(
state: FormBranchesState,
{ value: warnFeatureSchema }: SetwarnFeatureSchemaAction,
): FormBranchesState {
return {
...state,
warnFeatureSchema,
};
}
type SetEqualRatioAction = {
type: "setEqualRatio";
value: FormBranchesState["equalRatio"];
};
function setEqualRatio(
state: FormBranchesState,
{ value: equalRatio }: SetEqualRatioAction,
): FormBranchesState {
let { referenceBranch, treatmentBranches } = state;
if (equalRatio) {
if (referenceBranch !== null) {
referenceBranch = { ...referenceBranch, ratio: 1 };
}
if (Array.isArray(treatmentBranches)) {
treatmentBranches = treatmentBranches.map(
(treatmentBranch) =>
treatmentBranch && {