Fix bug where toggling backend experiment also updates frontend
This commit is contained in:
parent
525f86faeb
commit
98ad392109
|
@ -51,6 +51,7 @@ export function* toggleExperiment( experimentName, currentVariation, source ) {
|
|||
type: TYPES.TOGGLE_EXPERIMENT,
|
||||
experimentName,
|
||||
newVariation,
|
||||
source,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ const reducer = ( state = DEFAULT_STATE, action ) => {
|
|||
experiments: state.experiments.map( ( experiment ) => ( {
|
||||
...experiment,
|
||||
variation:
|
||||
experiment.name === action.experimentName
|
||||
experiment.name === action.experimentName &&
|
||||
experiment.source === action.source
|
||||
? action.newVariation
|
||||
: experiment.variation,
|
||||
} ) ),
|
||||
|
|
|
@ -20,6 +20,7 @@ function Experiments( { experiments, toggleExperiment } ) {
|
|||
<tr>
|
||||
<th>Experiment</th>
|
||||
<th>Variation</th>
|
||||
<th>Source</th>
|
||||
<th>Toggle</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -32,6 +33,7 @@ function Experiments( { experiments, toggleExperiment } ) {
|
|||
{ name }
|
||||
</td>
|
||||
<td align="center">{ variation }</td>
|
||||
<td align="center">{ source }</td>
|
||||
<td align="center">
|
||||
<Button
|
||||
onClick={ () => {
|
||||
|
|
Loading…
Reference in New Issue