ktmud commented on a change in pull request #13109:
URL: https://github.com/apache/superset/pull/13109#discussion_r575716755



##########
File path: superset-frontend/src/visualizations/FilterBox/FilterBox.jsx
##########
@@ -336,10 +328,12 @@ class FilterBox extends React.PureComponent {
     // Add created options to filtersChoices, even though it doesn't exist,
     // or these options will exist in query sql but invisible to end user.
     Object.keys(selectedValues)
-      .filter(
-        key => selectedValues.hasOwnProperty(key) && key in filtersChoices,
-      )
+      .filter(key => key in filtersChoices)
       .forEach(key => {
+        // empty values are ignored
+        if (!selectedValues[key]) {
+          return;
+        }

Review comment:
       This will fix this bug:
   
   ### Before
   
   <img width="382" alt="has-empty-value" 
src="https://user-images.githubusercontent.com/335541/107862200-0d78ad80-6e00-11eb-9771-ae67c11058f5.png";>
   
   ### After
   
   <img width="386" alt="no-empty-value" 
src="https://user-images.githubusercontent.com/335541/107862203-12d5f800-6e00-11eb-8ef3-303fea3d56ee.png";>
   

##########
File path: superset-frontend/src/visualizations/FilterBox/FilterBox.jsx
##########
@@ -356,21 +350,21 @@ class FilterBox extends React.PureComponent {
             });
           });
       });
-    const { key, label } = filterConfig;
+    const {
+      key,
+      label,
+      [FILTER_CONFIG_ATTRIBUTES.MULTIPLE]: isMultiple,
+      [FILTER_CONFIG_ATTRIBUTES.DEFAULT_VALUE]: defaultValue,
+      [FILTER_CONFIG_ATTRIBUTES.CLEARABLE]: isClearable,
+      [FILTER_CONFIG_ATTRIBUTES.SEARCH_ALL_OPTIONS]: searchAllOptions,
+    } = filterConfig;

Review comment:
       I also did some light refactoring to make the code easier to read.

##########
File path: superset-frontend/src/visualizations/constants.js
##########
@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-export const TIME_CHOICES = [
-  '1 hour ago',
-  '12 hours ago',
-  '1 day ago',
-  '7 days ago',
-  '28 days ago',
-  '90 days ago',
-  '1 year ago',
-];

Review comment:
       Bycatch: this constant is not used anywhere. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to