onurtashan opened a new pull request, #40075:
URL: https://github.com/apache/superset/pull/40075

   ## Summary
   
   When `brandLogoUrl` is set in `THEME_DEFAULT` (or any theme) without 
providing `brandLogoHref`, the app crashes with a white screen:
   
   ```
   TypeError: Cannot read properties of undefined (reading 'startsWith')
       at ensureAppRoot (616.94c331d4202698eb2aa9.entry.js)
       at renderBrand (8085.4bc9b7059e85ba458bcb.entry.js)
   ```
   
   `ensureAppRoot` immediately calls `.startsWith()` on its argument, which is 
`undefined` when `brandLogoHref` is not provided.
   
   This affects:
   - Any deployment setting `brandLogoUrl` without `brandLogoHref`
   - Dark theme with `brandLogoUrl` (reported in #39855)
   
   ## Fix
   
   Default `brandLogoHref` to `'/'` at the call site using nullish coalescing:
   
   ```tsx
   // Before
   <StyledBrandLink href={ensureAppRoot(theme.brandLogoHref)}>
   
   // After
   <StyledBrandLink href={ensureAppRoot(theme.brandLogoHref ?? '/')}>
   ```
   
   `ensureAppRoot('/')` handles subdirectory deployments correctly by 
prepending `SUPERSET_APP_ROOT`.
   
   ## Testing
   
   Set `THEME_DEFAULT` with `brandLogoUrl` but no `brandLogoHref` in 
`superset_config.py`:
   
   ```python
   THEME_DEFAULT = {
       "token": {
           "brandLogoUrl": "/static/assets/images/my_logo.png",
       }
   }
   ```
   
   Before fix: white screen crash. After fix: logo renders correctly, defaults 
to linking to `/`.
   
   Closes #39855
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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