You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org> on 2026/04/20 20:03:16 UTC

Re: [PR] feat(semantic layers): rename database and dataset [superset]

codeant-ai-for-open-source[bot] commented on code in PR #38611:
URL: https://github.com/apache/superset/pull/38611#discussion_r3113345110


##########
superset-frontend/src/explore/components/controls/DatasourceControl/index.tsx:
##########
@@ -587,14 +593,31 @@ class DatasourceControl extends PureComponent<
             )}
           </div>
         )}
-        {showEditDatasourceModal && (
-          <DatasourceModal
-            datasource={datasource}
-            show={showEditDatasourceModal}
-            onDatasourceSave={this.onDatasourceSave}
-            onHide={this.toggleEditDatasourceModal}
-          />
-        )}
+        {showEditDatasourceModal &&
+          (datasource.type === DatasourceType.SemanticView ? (
+            <SemanticViewEditModal
+              show={showEditDatasourceModal}
+              onHide={this.toggleEditDatasourceModal}
+              onSave={() => {
+                if (this.props.onDatasourceSave) {
+                  this.props.onDatasourceSave(datasource);
+                }

Review Comment:
   **Suggestion:** The semantic-view edit flow bypasses the component's internal save handler and only calls the external callback, so datasource state updates handled by the control are skipped after saving. Route the callback through the existing save handler to keep Explore state consistent with other datasource edit paths. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Semantic view metadata stale in Explore after inline edit.
   - ⚠️ Explore datasource Redux state not refreshed post semantic edit.
   ```
   </details>
   
   ```suggestion
                     this.onDatasourceSave(datasource);
   ```
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Open Explore for a chart whose datasource is a semantic view so that the `datasource`
   control is rendered, as wired in `superset-frontend/src/explore/controls.tsx:216-225`
   (control type `DatasourceControl` fed from `state.datasource`).
   
   2. In Explore, click the datasource menu and choose "Edit …", which dispatches
   `EDIT_DATASET` in `handleMenuItemClick`
   (`superset-frontend/src/explore/components/controls/DatasourceControl/index.tsx:314-322`),
   setting `showEditDatasourceModal` and causing the semantic-view branch at lines 597-613
   (diff hunk) to render `<SemanticViewEditModal>` when `datasource.type ===
   DatasourceType.SemanticView`.
   
   3. In the `SemanticViewEditModal`
   (`superset-frontend/src/features/semanticViews/SemanticViewEditModal.tsx:68-80`), change
   the description or cache timeout and click Save; `handleSave` performs a
   `SupersetClient.put` to `/api/v1/semantic_view/${semanticView.id}` and on success calls
   the `onSave` prop then `onHide()`.
   
   4. The `onSave` prop provided by `DatasourceControl` at
   `superset-frontend/src/explore/components/controls/DatasourceControl/index.tsx:602-605`
   only calls `this.props.onDatasourceSave(datasource)` and never invokes the internal
   `onDatasourceSave` method at lines 255-288, which wraps `actions.changeDatasource` and
   adjusts time controls; because Explore's `datasource` control wiring in
   `controls.tsx:216-225` does not pass an `onDatasourceSave` prop, this callback is
   effectively a no-op and the Explore Redux `datasource` state (including
   description/cache_timeout fields) remains stale after saving the semantic view until the
   page or datasource is reloaded.
   ```
   </details>
   
   [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fsrc%2Fexplore%2Fcomponents%2Fcontrols%2FDatasourceControl%2Findex.tsx%0A%2A%2ALine%3A%2A%2A%20603%3A604%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20The%20semantic-view%20edit%20flow%20bypasses%20the%20component%27s%20internal%20save%20handler%20and%20only%20calls%20the%20external%20callback%2C%20so%20datasource%20state%20updates%20handled%20by%20the%20control%20are%20skipped%20after%20saving.%20Route%20the%20callback%20through%20the%20existing%20save%20handler%20to%20keep%20Explore%20state%20consistent%20with%20other%20datasource%20edit%20paths.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%2
 0other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fsrc%2Fexplore%2Fcomponents%2Fcontrols%2FDatasourceControl%2Findex.tsx%0A%2A%2ALine%3A%2A%2A%20603%3A604%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20The%20semantic-view%20edit%20flow%20bypasses%20the%20component%27s%20internal%20save%20handler%20and%20only%20calls%20the%20external%20callback%2C%20so%20datasource%20state%20updates%20handled%20by%20the%20control%20are%20skipped%20after%20saving.%20Route%20the%20callback%20through%20the%20existing%20save%20handler%20to%20keep%20Explore%20state%20consistent%20with%2
 0other%20datasource%20edit%20paths.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/explore/components/controls/DatasourceControl/index.tsx
   **Line:** 603:604
   **Comment:**
   	*Logic Error: The semantic-view edit flow bypasses the component's internal save handler and only calls the external callback, so datasource state updates handled by the control are skipped after saving. Route the callback through the existing save handler to keep Explore state consistent with other datasource edit paths.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38611&comment_hash=bce5c2865f066facd56a31fb4de871bcc5202e416fd2484b9fd9979125fa9352&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38611&comment_hash=bce5c2865f066facd56a31fb4de871bcc5202e416fd2484b9fd9979125fa9352&reaction=dislike'>👎</a>



-- 
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-unsubscribe@superset.apache.org

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


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