graceguo-supercat commented on a change in pull request #9213: [fix] remove 
chart id from filter_scopes metadata if chart is not in dash anymore
URL: 
https://github.com/apache/incubator-superset/pull/9213#discussion_r384825903
 
 

 ##########
 File path: superset/utils/dashboard_filter_scopes_converter.py
 ##########
 @@ -77,10 +77,13 @@ def copy_filter_scopes(
 ) -> Dict:
     new_filter_scopes = {}
     for (slice_id, scopes) in old_filter_scopes.items():
-        new_filter_key = old_to_new_slc_id_dict[int(slice_id)]
-        new_filter_scopes[str(new_filter_key)] = scopes
-        for scope in scopes.values():
-            scope["immune"] = [
-                old_to_new_slc_id_dict[slice_id] for slice_id in 
scope.get("immune")
-            ]
+        new_filter_key = old_to_new_slc_id_dict.get(int(slice_id))
+        if new_filter_key:
+            new_filter_scopes[str(new_filter_key)] = scopes
+            for scope in scopes.values():
+                scope["immune"] = [
+                    old_to_new_slc_id_dict[slice_id]
+                    for slice_id in scope.get("immune")
+                    if old_to_new_slc_id_dict.get(slice_id) is not None
 
 Review comment:
   it is necessary.  line 81 is check filter slice is still in the dashboard, 
line 87 is to check if immune charts still in current dashboard.

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