From 9110b41c9ad3e103d769f131f6418f314b805db1 Mon Sep 17 00:00:00 2001 From: Michelle Thomas Date: Tue, 22 May 2018 16:30:12 -0700 Subject: [PATCH 1/2] Translate string to array for multi fields in getControlsState --- superset/assets/src/explore/store.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/superset/assets/src/explore/store.js b/superset/assets/src/explore/store.js index 4f1e7b5612c1c..f94585b29cf02 100644 --- a/superset/assets/src/explore/store.js +++ b/superset/assets/src/explore/store.js @@ -56,6 +56,10 @@ export function getControlsState(state, form_data) { delete control.mapStateToProps; } + if (control.multi && typeof formData[k] === 'string') { + formData[k] = [formData[k]]; + } + // If the value is not valid anymore based on choices, clear it if (control.type === 'SelectControl' && control.choices && k !== 'datasource' && formData[k]) { const choiceValues = control.choices.map(c => c[0]); From d955c13a855279e74e7dd050af28715af4dec309 Mon Sep 17 00:00:00 2001 From: Michelle Thomas Date: Wed, 23 May 2018 11:47:46 -0700 Subject: [PATCH 2/2] Updating format to fit on one line --- superset/assets/src/explore/store.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/superset/assets/src/explore/store.js b/superset/assets/src/explore/store.js index f94585b29cf02..32c132fd42a50 100644 --- a/superset/assets/src/explore/store.js +++ b/superset/assets/src/explore/store.js @@ -56,9 +56,8 @@ export function getControlsState(state, form_data) { delete control.mapStateToProps; } - if (control.multi && typeof formData[k] === 'string') { - formData[k] = [formData[k]]; - } + formData[k] = (control.multi && formData[k] && !Array.isArray(formData[k])) ? [formData[k]] + : formData[k]; // If the value is not valid anymore based on choices, clear it if (control.type === 'SelectControl' && control.choices && k !== 'datasource' && formData[k]) {