alexandrusoare commented on code in PR #43988:
URL: https://github.com/apache/superset/pull/43988#discussion_r3958884490


##########
superset/models/slice.py:
##########
@@ -496,13 +496,36 @@ def set_related_perm(_mapper: Mapper, _connection: 
Connection, target: Slice) ->
     # pylint: disable=import-outside-toplevel
     from superset.daos.datasource import DatasourceDAO
 
-    src_class = DatasourceDAO.sources[target.datasource_type]
+    # This listener also runs on updates, so clear the derived values before
+    # attempting to resolve the datasource. Otherwise an unmapped or deleted
+    # datasource can retain permission strings copied from a previous one.
+    target.perm = None

Review Comment:
   Clearing all three perm strings before re-resolving means if the datasource 
was deleted between FK assignment and flush, the chart silently becomes 
invisible to every user — previously it kept stale-but-queryable perms. Is this 
intentional?



##########
superset-frontend/src/explore/components/SaveModal.tsx:
##########
@@ -532,8 +532,13 @@ const SaveModal = ({
           }
         }
 
-        // Sets the form data
-        actions.setFormData({ ...formData });
+        // Saving a Query as a dataset synchronously updates form_data through
+        // changeDatasource. Re-applying this render's Query-backed form_data
+        // would overwrite that conversion just before createSlice reads the
+        // store, causing the chart API to receive datasource_type="query".
+        if (datasource?.type !== DatasourceType.Query) {

Review Comment:
   This skips setFormData entirely for query-type saves, but formData also 
carries dashboards and selectedTabId mutated above (lines 519–532) — 
changeDatasource only updates the datasource portion of Redux state, so doesn't 
this drop the dashboard assignment when saving a SQL Lab chart to a 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.

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