Skip to content

Commit

Permalink
Translate string to array for multi fields in getControlsState (apach…
Browse files Browse the repository at this point in the history
…e#5057)

* Translate string to array for multi fields in getControlsState

* Updating format to fit on one line
  • Loading branch information
michellethomas authored and timifasubaa committed May 31, 2018
1 parent 7403dbf commit 19bea13
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions superset/assets/src/explore/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export function getControlsState(state, form_data) {
delete control.mapStateToProps;
}

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]) {
const choiceValues = control.choices.map(c => c[0]);
Expand Down

0 comments on commit 19bea13

Please sign in to comment.