You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "martyngigg (via GitHub)" <gi...@apache.org> on 2025/11/10 17:19:38 UTC
[PR] fix(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
martyngigg opened a new pull request, #36058:
URL: https://github.com/apache/superset/pull/36058
### SUMMARY
Fixes for the settings menu:
- includes app root in the link to the user information
- removes old superset/fab_overrides template references. The templates were removed in #34093.
- fixes 'Create chart' button on SQL lab interface in the presence of a non-empty application root
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
Fixes #35027
- [x] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] 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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "martyngigg (via GitHub)" <gi...@apache.org>.
martyngigg commented on PR #36058:
URL: https://github.com/apache/superset/pull/36058#issuecomment-3546367398
> Looks like CI passed (yay!) but there's a conflict to resolve (dang!).
Thanks for nudge. Should be fixed now.
--
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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #36058:
URL: https://github.com/apache/superset/pull/36058#issuecomment-3512988794
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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #36058:
URL: https://github.com/apache/superset/pull/36058#discussion_r2519365845
##########
superset-frontend/src/utils/assetUrl.test.ts:
##########
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import * as getBootstrapData from 'src/utils/getBootstrapData';
+import { assetUrl, ensureStaticPrefix } from './assetUrl';
+
+const staticAssetsPrefixMock = jest.spyOn(
+ getBootstrapData,
+ 'staticAssetsPrefix',
+);
+const resourcePath = '/endpoint/img.png';
+const absoluteResourcePath = `https://cdn.domain.com/static${resourcePath}`;
+
+beforeEach(() => {
+ // Clear app root
+ staticAssetsPrefixMock.mockReturnValue('');
+});
+
+describe('assetUrl should prepend static asset prefix', () => {
+ it.each(['', '/myapp'])("'%s' for relative path", app_root => {
+ staticAssetsPrefixMock.mockReturnValue(app_root);
+ expect(assetUrl(resourcePath)).toBe(`${app_root}${resourcePath}`);
+ expect(assetUrl(absoluteResourcePath)).toBe(
+ `${app_root}/${absoluteResourcePath}`,
+ );
Review Comment:
The test for `assetUrl` with an absolute URL (line 38-40) expects it to prepend the app root and a slash, which would produce invalid URLs like `/myapp/https://cdn.domain.com/static/endpoint/img.png`. The `assetUrl` function is designed for relative paths only. This test case should either be removed or moved to a separate test that validates `assetUrl` should not be used with absolute URLs.
```suggestion
```
##########
superset-frontend/src/utils/assetUrl.test.ts:
##########
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import * as getBootstrapData from 'src/utils/getBootstrapData';
+import { assetUrl, ensureStaticPrefix } from './assetUrl';
+
+const staticAssetsPrefixMock = jest.spyOn(
+ getBootstrapData,
+ 'staticAssetsPrefix',
+);
+const resourcePath = '/endpoint/img.png';
+const absoluteResourcePath = `https://cdn.domain.com/static${resourcePath}`;
+
+beforeEach(() => {
+ // Clear app root
Review Comment:
The comment says "Clear app root" but the code is actually clearing the static assets prefix mock. The comment should be updated to "Clear static assets prefix" to accurately reflect what the code is doing.
```suggestion
// Clear static assets prefix
```
##########
superset-frontend/src/features/home/Menu.test.tsx:
##########
@@ -247,6 +252,8 @@ fetchMock.get(
beforeEach(() => {
// setup a DOM element as a render target
useSelectorMock.mockClear();
+ // By default use empty app root
Review Comment:
The comment says "By default use empty app root" but the code is actually setting the static assets prefix mock to an empty string. The comment should be updated to "By default use empty static assets prefix" to accurately reflect what the code is doing.
```suggestion
// By default use empty static assets prefix
```
--
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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "martyngigg (via GitHub)" <gi...@apache.org>.
martyngigg commented on PR #36058:
URL: https://github.com/apache/superset/pull/36058#issuecomment-3627386652
@sadpandajoe Do you think it's possible this could make it into v6?
--
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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #36058:
URL: https://github.com/apache/superset/pull/36058#issuecomment-3544170847
Looks like CI passed (yay!) but there's a conflict to resolve (dang!).
--
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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "martyngigg (via GitHub)" <gi...@apache.org>.
martyngigg commented on PR #36058:
URL: https://github.com/apache/superset/pull/36058#issuecomment-3799549111
@sadpandajoe Could this be included in the v6.0 branch?
--
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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "martyngigg (via GitHub)" <gi...@apache.org>.
martyngigg commented on PR #36058:
URL: https://github.com/apache/superset/pull/36058#issuecomment-3799542889
Thanks for merging :)
--
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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "martyngigg (via GitHub)" <gi...@apache.org>.
martyngigg commented on PR #36058:
URL: https://github.com/apache/superset/pull/36058#issuecomment-3527120656
Is there a way I can rerun a single check? I think "[Python-Integration / test-mysql" is flaky?
--
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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #36058:
URL: https://github.com/apache/superset/pull/36058#discussion_r2511375361
##########
superset-frontend/src/utils/pathUtils.ts:
##########
@@ -26,3 +26,11 @@ import { applicationRoot } from 'src/utils/getBootstrapData';
export function ensureAppRoot(path: string): string {
return `${applicationRoot()}${path.startsWith('/') ? path : `/${path}`}`;
}
+
+/**
+ * Takes a string path to a resource and remove the applicationRoot if it is not empty
+ * @param path A string path to a resource
+ */
+export function stripAppRoot(path: string): string {
+ return `${path.startsWith(applicationRoot()) ? path.slice(applicationRoot().length) : path}`;
Review Comment:
### Empty applicationRoot causes incorrect path stripping <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The stripAppRoot function will fail when applicationRoot() returns an empty string, as path.startsWith('') always returns true for any string.
###### Why this matters
When applicationRoot() is empty, all paths will be processed as if they start with the application root, causing the function to incorrectly slice characters from the beginning of every path, potentially breaking URL routing and resource loading.
###### Suggested change β *Feature Preview*
Add a check to ensure applicationRoot is not empty before attempting to strip it:
```typescript
export function stripAppRoot(path: string): string {
const appRoot = applicationRoot();
return appRoot && path.startsWith(appRoot) ? path.slice(appRoot.length) : path;
}
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/6f973e64-e5f0-4e34-b19e-9dcf9d476514/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/6f973e64-e5f0-4e34-b19e-9dcf9d476514?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/6f973e64-e5f0-4e34-b19e-9dcf9d476514?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/6f973e64-e5f0-4e34-b19e-9dcf9d476514?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/6f973e64-e5f0-4e34-b19e-9dcf9d476514)
</details>
<sub>
π¬ Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:f3f21509-7279-485a-91c5-aa08be9aee08 -->
[](f3f21509-7279-485a-91c5-aa08be9aee08)
##########
superset-frontend/src/SqlLab/components/ResultSet/index.tsx:
##########
@@ -292,7 +292,7 @@ const ResultSet = ({
if (openInNewWindow) {
window.open(url, '_blank', 'noreferrer');
} else {
- history.push(url);
+ history.push(stripAppRoot(url));
Review Comment:
### Uncached stripAppRoot call on navigation <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The stripAppRoot function is called on every navigation without caching the result, potentially causing unnecessary string processing overhead.
###### Why this matters
If stripAppRoot performs complex string operations and this navigation happens frequently, the repeated function calls could impact performance, especially in scenarios with many chart creations.
###### Suggested change β *Feature Preview*
Consider caching the result of stripAppRoot(url) in a variable if the same URL might be processed multiple times, or ensure stripAppRoot is optimized for repeated calls with memoization.
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e4954dbf-7488-40c2-a4fa-f7093e37bff3/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e4954dbf-7488-40c2-a4fa-f7093e37bff3?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e4954dbf-7488-40c2-a4fa-f7093e37bff3?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e4954dbf-7488-40c2-a4fa-f7093e37bff3?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e4954dbf-7488-40c2-a4fa-f7093e37bff3)
</details>
<sub>
π¬ Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:ec912579-f685-45b0-adcb-ed3c470730c9 -->
[](ec912579-f685-45b0-adcb-ed3c470730c9)
--
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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #36058:
URL: https://github.com/apache/superset/pull/36058#issuecomment-3513209558
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/36058?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 68.67%. Comparing base ([`c42e3c6`](https://app.codecov.io/gh/apache/superset/commit/c42e3c68373f9a90b2b9f8e7f3341bf13e2fe37a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`0e3f867`](https://app.codecov.io/gh/apache/superset/commit/0e3f867704c435ba79b781e5d8042934581b347e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 3 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #36058 +/- ##
===========================================
+ Coverage 0 68.67% +68.67%
===========================================
Files 0 622 +622
Lines 0 45738 +45738
Branches 0 4978 +4978
===========================================
+ Hits 0 31410 +31410
- Misses 0 13080 +13080
- Partials 0 1248 +1248
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/36058/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Ξ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/36058/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `44.16% <ΓΈ> (?)` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/36058/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `67.83% <ΓΈ> (?)` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/36058/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `47.71% <ΓΈ> (?)` | |
| [python](https://app.codecov.io/gh/apache/superset/pull/36058/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `68.64% <ΓΈ> (?)` | |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/36058/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `67.45% <ΓΈ> (?)` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/36058/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ΓΈ> (?)` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/36058?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #36058:
URL: https://github.com/apache/superset/pull/36058
--
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(superset-frontend): Fixes for broken functionality when an application root is defined [superset]
Posted by "martyngigg (via GitHub)" <gi...@apache.org>.
martyngigg commented on PR #36058:
URL: https://github.com/apache/superset/pull/36058#issuecomment-3745204439
korbit-ai has requested changes but I can't what they are. Their docs link doesn't work to ask for a re-review either. Can anyone help with that?
--
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