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,
|
type: TYPES.TOGGLE_EXPERIMENT,
|
||||||
experimentName,
|
experimentName,
|
||||||
newVariation,
|
newVariation,
|
||||||
|
source,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ const reducer = ( state = DEFAULT_STATE, action ) => {
|
||||||
experiments: state.experiments.map( ( experiment ) => ( {
|
experiments: state.experiments.map( ( experiment ) => ( {
|
||||||
...experiment,
|
...experiment,
|
||||||
variation:
|
variation:
|
||||||
experiment.name === action.experimentName
|
experiment.name === action.experimentName &&
|
||||||
|
experiment.source === action.source
|
||||||
? action.newVariation
|
? action.newVariation
|
||||||
: experiment.variation,
|
: experiment.variation,
|
||||||
} ) ),
|
} ) ),
|
||||||
|
|
|
@ -20,6 +20,7 @@ function Experiments( { experiments, toggleExperiment } ) {
|
||||||
<tr>
|
<tr>
|
||||||
<th>Experiment</th>
|
<th>Experiment</th>
|
||||||
<th>Variation</th>
|
<th>Variation</th>
|
||||||
|
<th>Source</th>
|
||||||
<th>Toggle</th>
|
<th>Toggle</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -32,6 +33,7 @@ function Experiments( { experiments, toggleExperiment } ) {
|
||||||
{ name }
|
{ name }
|
||||||
</td>
|
</td>
|
||||||
<td align="center">{ variation }</td>
|
<td align="center">{ variation }</td>
|
||||||
|
<td align="center">{ source }</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<Button
|
<Button
|
||||||
onClick={ () => {
|
onClick={ () => {
|
||||||
|
|
Loading…
Reference in New Issue