mikebridge commented on code in PR #45482:
URL: https://github.com/apache/superset/pull/45482#discussion_r4329424753


##########
superset/versioning/restore.py:
##########
@@ -742,11 +748,35 @@ def _restore_dashboard_membership(dashboard: Any, 
transaction_id: int) -> list[i
             if window.contains(transaction_id)
         }
     )
-    if not member_ids:
-        dashboard.slices = []
-        return []
-
-    live_slices = 
db.session.query(Slice).filter(Slice.id.in_(member_ids)).all()
+    # Archived charts must be visible both to the lookup and to the
+    # assignment, which diffs against the current membership. A membership
+    # loaded through ``dashboard.slices`` misses archived members, even inside
+    # the bypass, because the dashboard's own load carried the filter, so the
+    # flush would keep or re-insert their rows. Read it from the association
+    # table instead and diff against that.

Review Comment:
   Thanks, that's a precise repro, and it explains why I couldn't reproduce it 
earlier: my test built the dashboard in the same session, so `slices` was 
already loaded with the archived chart in it. I'll take it with the 
association-table baseline as you suggested, plus an API round-trip test that 
loads the dashboard fresh. Separate PR to follow; I'll keep this one focused.



-- 
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: [email protected]

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