You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "aminghadersohi (via GitHub)" <gi...@apache.org> on 2026/01/16 00:43:00 UTC
[PR] fix(sqllab): show virtual dataset banner only when isDataset param is true [superset]
aminghadersohi opened a new pull request, #37184:
URL: https://github.com/apache/superset/pull/37184
### SUMMARY
This PR fixes a bug where the "You are editing a query from the virtual dataset" banner was incorrectly shown in SQL Lab for any URL with query parameters.
**The Problem:**
When opening SQL Lab via URL with query parameters (e.g., `/sqllab?dbid=1&schema=public&sql=SELECT...`), the `LocationContext` was hardcoding `isDataset: true` regardless of whether the `isDataset` parameter was actually passed.
**The Fix:**
- Changed `isDataset: true` to `isDataset: queryParams.get('isDataset') === 'true'` in `LocationContext.tsx`
- This ensures the virtual dataset banner only appears when explicitly intended (i.e., when editing a virtual dataset from the dataset editor which passes `isDataset=true`)
Also fixes a typo: "edting" โ "editing" in the banner text.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
**Before:** Virtual dataset banner appears incorrectly when opening SQL Lab via URL with any query parameters
**After:** Banner only appears when `isDataset=true` is explicitly passed in the URL
### TESTING INSTRUCTIONS
1. Open SQL Lab with query parameters but WITHOUT `isDataset=true`:
- Navigate to `/sqllab?dbid=1&schema=public&sql=SELECT%201`
- Verify the virtual dataset banner does NOT appear
2. Open SQL Lab with `isDataset=true`:
- Navigate to `/sqllab?dbid=1&schema=public&sql=SELECT%201&isDataset=true`
- Verify the virtual dataset banner DOES appear
3. Open SQL Lab from a virtual dataset's "Edit SQL" button:
- Go to a virtual dataset's settings
- Click the SQL Lab link
- Verify the banner appears correctly
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration
- [ ] 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-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
Re: [PR] fix(sqllab): show virtual dataset banner only when isDataset param is true [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #37184:
URL: https://github.com/apache/superset/pull/37184#issuecomment-3757542780
CodeAnt AI is reviewing your PR.
---
### Thanks for using CodeAnt! ๐
We're free for open-source projects. if you're enjoying it, help us grow by sharing.
[Share on X](https://twitter.com/intent/tweet?text=Just%20tried%20%40CodeAntAI%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos.%20Worth%20checking%20out%3A&url=https%3A//codeant.ai) ยท
[Reddit](https://www.reddit.com/submit?title=Check%20out%20CodeAnt%20for%20automated%20code%20review&text=Just%20tried%20CodeAnt%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos.%20Worth%20checking%20out%3A%20https%3A//codeant.ai) ยท
[LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcodeant.ai&mini=true&title=Check%20out%20CodeAnt%20for%20automated%20code%20review&summary=Just%20tried%20CodeAnt%20for%20automated%20code%20review%20and%20I%27m%20impressed%21%20Free%20for%20open%20source%20with%20a%20free%20trial%20for%20private%20repos)
--
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
Re: [PR] fix(sqllab): show virtual dataset banner only when isDataset param is true [superset]
Posted by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org>.
Antonio-RiveroMartnez merged PR #37184:
URL: https://github.com/apache/superset/pull/37184
--
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
Re: [PR] fix(sqllab): show virtual dataset banner only when isDataset param is true [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #37184:
URL: https://github.com/apache/superset/pull/37184#discussion_r2696463877
##########
superset-frontend/src/pages/SqlLab/LocationContext.tsx:
##########
@@ -40,13 +40,14 @@ export const LocationProvider: FC = ({ children }: { children: ReactNode }) => {
const permalink = location.pathname.match(/\/p\/\w+/)?.[0].slice(3);
Review Comment:
**Suggestion:** Runtime error risk: calling `.slice(3)` after optional chaining on the match result can throw if the match is null/undefined; make the slice call safe by using optional chaining before `.slice` so no method is invoked on undefined. [null pointer]
<details>
<summary><b>Severity Level:</b> Critical ๐จ</summary>
```mdx
- โ SQL Lab page fails to mount (LocationProvider crash).
- โ Visiting /sqllab or query-parameter URLs triggers crash.
- โ ๏ธ Virtual dataset banner evaluation disrupted.
- โ ๏ธ Any consumer of useLocationState impacted during mount.
```
</details>
```suggestion
const permalink = location.pathname.match(/\/p\/\w+/)?.[0]?.slice(3);
```
<details>
<summary><b>Steps of Reproduction โ
</b></summary>
```mdx
1. Open the frontend and navigate to the SQL Lab page so the LocationProvider mounts.
LocationProvider is defined in superset-frontend/src/pages/SqlLab/LocationContext.tsx
(lines 34-56 in the PR hunk).
2. Ensure the browser pathname does NOT contain a permalink matching /p/\w+ (for example,
visit /sqllab or /sqllab?dbid=1&schema=public โ pathname is "/sqllab"). The code that
computes permalink is at line 40: `const permalink =
location.pathname.match(/\/p\/\w+/)?.[0].slice(3);`.
3. When LocationProvider executes that line, `location.pathname.match(/\/p\/\w+/)` returns
null, the optional chaining `?.[0]` evaluates to undefined, and `.slice(3)` is invoked on
undefined causing a TypeError at
superset-frontend/src/pages/SqlLab/LocationContext.tsx:40. This throws during component
render/mount.
4. Observe the component crash (uncaught TypeError) preventing LocationProvider from
returning a valid Provider and breaking SQL Lab rendering. Replacing the line with the
suggested safe call (`?.[0]?.slice(3)`) prevents the TypeError by short-circuiting slice
when no match exists.
```
</details>
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/pages/SqlLab/LocationContext.tsx
**Line:** 40:40
**Comment:**
*Null Pointer: Runtime error risk: calling `.slice(3)` after optional chaining on the match result can throw if the match is null/undefined; make the slice call safe by using optional chaining before `.slice` so no method is invoked on undefined.
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.
```
</details>
--
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
Re: [PR] fix(sqllab): show virtual dataset banner only when isDataset param is true [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #37184:
URL: https://github.com/apache/superset/pull/37184#issuecomment-3757549300
### <span aria-hidden="true">โ
</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">๐จ</span> Latest commit | 31a8c41dd28e53280dcd336e66425d8575beaa71 |
|<span aria-hidden="true">๐</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/69698995b003ae000799b2e2 |
|<span aria-hidden="true">๐</span> Deploy Preview | [https://deploy-preview-37184--superset-docs-preview.netlify.app](https://deploy-preview-37184--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">๐ฑ</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-37184--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
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
Re: [PR] fix(sqllab): show virtual dataset banner only when isDataset param is true [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37184:
URL: https://github.com/apache/superset/pull/37184#issuecomment-3757543004
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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
Re: [PR] fix(sqllab): show virtual dataset banner only when isDataset param is true [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #37184:
URL: https://github.com/apache/superset/pull/37184#issuecomment-3757549293
CodeAnt AI finished reviewing your PR.
--
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