Skip to content

Commit

Permalink
fix: toggle flag (#3480)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg committed Feb 28, 2024
1 parent e5f29a1 commit 87cfcd9
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions frontend/common/providers/FeatureListProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,26 @@ const FeatureListProvider = class extends React.Component {
this.editFeatureValue(
projectId,
environmentId,
/* todo: Saving features involves sending an adjusted project flag rather than a feature state (old tech debt).
This will be removed when migrating to RTK. The following converts the feature state to the accepted format.
*/
{
...projectFlag,
default_enabled: !environmentFlag.enabled,
initial_value: environmentFlag.feature_state_value,
multivariate_options: projectFlag.multivariate_options.map((mv) => {
const matching =
environmentFlag.multivariate_feature_state_values.find(
(v) => v.multivariate_feature_option == mv.id,
)
return {
...mv,
default_percentage_allocation: matching.percentage_allocation,
}
}),
},
projectFlag,
{
...environmentFlag,
enabled: !environmentFlag.enabled,
},
environmentFlag,
)
}

Expand Down

0 comments on commit 87cfcd9

Please sign in to comment.