From 05258ebc6cb680b41b0cd1868555e6766c0eb35c Mon Sep 17 00:00:00 2001 From: Victor Malai Date: Tue, 8 Dec 2020 08:53:26 +0200 Subject: [PATCH] fix(event-flow-viz): handle null metadata selection (#11885) * Initialize object with empty array if is multiselect, fix 500 BE error * modify data coming --- .../src/explore/components/controls/SelectControl.jsx | 3 +-- superset/viz.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/SelectControl.jsx b/superset-frontend/src/explore/components/controls/SelectControl.jsx index 9b8baee14424d..283139ac75bf3 100644 --- a/superset-frontend/src/explore/components/controls/SelectControl.jsx +++ b/superset-frontend/src/explore/components/controls/SelectControl.jsx @@ -102,10 +102,9 @@ export default class SelectControl extends React.PureComponent { // Beware: This is acting like an on-click instead of an on-change // (firing every time user chooses vs firing only if a new option is chosen). onChange(opt) { - let optionValue = null; + let optionValue = this.props.multi ? [] : null; if (opt) { if (this.props.multi) { - optionValue = []; opt.forEach(o => { // select all options if (o.meta === true) { diff --git a/superset/viz.py b/superset/viz.py index e63f2c0804cf3..de5d597f73d90 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -2701,7 +2701,7 @@ def query_obj(self) -> QueryObjectDict: entity_key = form_data["entity"] meta_keys = [ col - for col in form_data["all_columns"] + for col in form_data["all_columns"] or [] if col != event_key and col != entity_key ]