Skip to content

Conversation

martyngigg
Copy link
Contributor

@martyngigg martyngigg commented Sep 1, 2025

SUMMARY

Since the theming changes, if an app_root is set to a non-empty value, the brand logo failed to render as the src link was incorrect. I think this is a bug against 6.0?

These changes include the app_root prefix similarly to other places across the frontend.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

Add SUPERSET_APP_ROOT="/workspace/example" to docker/.env-local.

Spin up the docker-compose-light stack and use the web developer tools to inspect the logo image src attribute. Before the change the asset link was missing the "/workspace/example" prefix but it is included after this change.

In development, using the webpack server, the image actually still appears as the image is in the superset/static/assets/images directory and the webpack server can still find it. I'm not sure how this can be fixed...

ADDITIONAL INFORMATION

  • Has associated issue: Fixes Invalid UI URL's with SUPERSET_APP_ROOT #35027
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@dosubot dosubot bot added change:frontend Requires changing the frontend home Namespace | Related to the Homepage labels Sep 1, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've completed my review and didn't find any issues.

Files scanned
File Path Reviewed
superset-frontend/src/features/home/Menu.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

@rusackas rusackas requested a review from msyavuz September 3, 2025 17:21
<Image
preview={false}
src={theme.brandLogoUrl}
src={assetUrl(theme.brandLogoUrl)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this cause issues when the brandLogoUrl is hosted outside Superset?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I have misunderstood how this now works with the new theming?

When assetUrl was originally implemented in #30134 it was assumed that STATIC_ASSETS_PREFIX would be a prefix to all static assets and if using a CDN for example then this would be set as the STATIC_ASSETS_PREFIX and this would then become a prefix to everything.

Similarly we have ensureAppRoot for prefixing non-asset paths.

I think I saw that the default theme.brandLogoUrl value was a relative path much like superset_config[APP_ICON] so I assumed the same rules applied. Maybe assetUrl() could also check the value passed to it is a relative path and only add the prefix then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe assetUrl() could also check the value passed to it is a relative path and only add the prefix then?

Yes, that would be my solution as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gone with adding a second assetUrlf that checks for the relative path as in the other places it is used the check is not necessary so it avoids wasting time in those places.

Checks if the path is relative and only
adds the static prefix if this is true
@pull-request-size pull-request-size bot added size/L and removed size/M labels Sep 8, 2025
Copy link
Contributor

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #495b24

Actionable Suggestions - 1
  • superset-frontend/src/features/home/Menu.tsx - 1
Additional Suggestions - 1
  • superset-frontend/src/features/home/Menu.test.tsx - 1
    • Path concatenation issue · Line 299-299
      The test assertion for brand icon src attribute has a path concatenation issue. When `app_root` is '/myapp' and `icon` is '/static/assets/images/superset-logo-horiz.png', the concatenation `${app_root}${icon}` produces '/myapp/static/assets/images/superset-logo-horiz.png' which could lead to double slashes or missing slashes depending on the values. Use proper path joining to ensure consistent asset URLs.
      Code suggestion
       @@ -299,1 +299,1 @@
      -    expect(image).toHaveAttribute('src', `${app_root}${icon}`);
      +    expect(image).toHaveAttribute('src', `${app_root}${icon}`.replace(/\/+/g, '/'));
Review Details
  • Files reviewed - 4 · Commit Range: 8c48ebb..d4b2fa7
    • superset-frontend/src/features/home/Menu.test.tsx
    • superset-frontend/src/features/home/Menu.tsx
    • superset-frontend/src/utils/assetUrl.test.ts
    • superset-frontend/src/utils/assetUrl.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@martyngigg
Copy link
Contributor Author

/resolve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:frontend Requires changing the frontend home Namespace | Related to the Homepage size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid UI URL's with SUPERSET_APP_ROOT
2 participants