Skip to content

Commit 61768dc

Browse files
authored
Only update selected variation values instead of overriding all (#288)
1 parent 7d9a523 commit 61768dc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/commands/variations/update.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('variations update', () => {
1212
const authFlags = ['--client-id', 'test-client-id', '--client-secret', 'test-client-secret']
1313
const featureKey = 'spam'
1414
const variationKey = 'variation'
15-
const requestVariables = { 'first-feature': true }
15+
const requestVariables = { 'first-feature': true, 'new-variable': false }
1616

1717
const requestBody = {
1818
'name': 'Test Variation',

src/commands/variations/update.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default class UpdateVariation extends UpdateCommandWithCommonProperties {
103103
{
104104
key: data.key,
105105
name: data.name,
106-
variables: variables ? JSON.parse(variables) : variableAnswers
106+
variables: variables ? JSON.parse(variables) : { ...selectedVariation.variables, ...variableAnswers }
107107
}
108108
)
109109
this.writer.showResults(result)

0 commit comments

Comments
 (0)