FredericoCoelhoNunes opened a new issue #9048: filter_values(key)[0] returning 
a dictionary
URL: https://github.com/apache/incubator-superset/issues/9048
 
 
   I am using filter_values in a custom source, in the following way:
   ```
   ...
   WHERE percentage_of_active_days >= {{ filter_values('activity_option')[0] if 
filter_values('activity_option')[0] else 0 }}
   AND n_events_per_day >= {{ filter_values('event_option')[0] if 
filter_values('event_option')[0] else 0 }}
   ```  
   This works just fine until I set the "activity_option" filter to 0. Then 
everything crashes, and that part of the query becomes ( from the debugger):
   
   ```
   ...
   WHERE percentage_of_active_days >= {'value': 0,
                                                   'label': 0,
                                                            'style': 
{'backgroundImage': 'linear-gradient(to right, lightgrey, lightgrey NaN%, 
rgba(0,0,0,0) NaN%',
                                                                                
         'padding': '2px 5px'}}
   AND n_events_per_day >= 0
   ```
   
   ### Expected results
   
   I expected filter_values to return 0 for both of those filters.
   
   ### Actual results
   
   All the queries that use the filter crash, and I also stop being able to 
access the filter until I reload the dashboard, because the filter box is 
replaced by the following error message:
   
   ```
   An error occurred while rendering the visualization: Error: Minified React 
error #31; visit 
https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Bvalue%2C%20label%2C%20style%7D&args[]=
 for the full message or use the non-minified dev environment for full errors 
and additional helpful warnings. 
   ```
   
   #### Screenshots
   
   If applicable, add screenshots to help explain your problem.
   
   #### How to reproduce the bug
   
   Not sure, but with my current setup/queries I keep getting this error. The 
filter works for every other value...
   
   ### Environment
   
   (please complete the following information):
   
   - superset version: Superset 0.35.2
   - python version: Python 3.6.9
   - node.js version: v13.0.1
   - npm version: 6.12.0
   
   ### Checklist
   
   Make sure these boxes are checked before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version 
of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   ### Additional context
   
   Add any other context about the problem here.
   

----------------------------------------------------------------
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]


With regards,
Apache Git Services

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

Reply via email to