john-bodley opened a new pull request, #22137:
URL: https://github.com/apache/superset/pull/22137

   <!---
   Please write the PR title following the conventions at 
https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   
   This PR fixes a bug which is exemplifies all that is wrong with Superset. 
Spaghetti code (exacerbated by the fact that the native and legacy filters use 
different form-data encodings) and half baked features—legacy charts vs. 
ECharts. 
   
   Specifically this issue—where the applied filter indicator is missing—seems 
to only surface for NVD3TimeSeriesViz charts with time comparisons using the 
non-native temporal filters. The non-native filters the legacy charts encode 
which filters are applied using the 
[applied_time_extras](https://github.com/apache/superset/blob/a9b229dd1dd9cb9dc8166b1392179fcccb4da138/superset/viz.py#L499-L502)
 form-data fields which is defined in the 
[merge_extra_filters](https://github.com/apache/superset/blob/e23efefc462fcc6f76a456f52f57f81e0c241a0a/superset/utils/core.py#L1185-L1186)
 method via an extraction of the `extra_filters` field—which is then disposed 
of. 
   
   The problem lies when this method is called multiple times (which is the 
case when Advanced Analytics are used which requires running extra queries and 
re-evaluating the query object thus re-invoking the `merge_extra_filters` 
method—this time with the `extra_filters` field missing from the form-data).
   
   The result is the `applied_time_extras` is now empty which translates to the 
filter indicator not reflecting that the temporal field has been defined. The 
solution is merely to preserve (as opposed to overwrite) the 
`applied_time_extras` field. 
   
   Note this issue only impacted the applied filter indicator, i.e., the 
filters were correctly applied to the underlying chart.
   
   
   <!--- Describe the change below, including rationale and design decisions -->
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   #### BEFORE
   
   <img width="1368" alt="Screen Shot 2022-11-15 at 9 31 50 PM" 
src="https://user-images.githubusercontent.com/4567245/202096555-47138967-5ee0-48de-9e86-ea50e9f83dae.png";>
   
   #### AFTER
   
   <img width="1367" alt="Screen Shot 2022-11-15 at 9 33 05 PM" 
src="https://user-images.githubusercontent.com/4567245/202096430-7ee22c29-4b3b-4147-9451-618556515537.png";>
   
   ### TESTING INSTRUCTIONS
   
   Added unit tests and tested locally.
    
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


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

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to