Abdulrehman-PIAIC80387 opened a new pull request, #39940:
URL: https://github.com/apache/superset/pull/39940
### SUMMARY
`ensureAppRoot()` in `superset-frontend/src/utils/pathUtils.ts` calls
`path.startsWith(...)` on its input without first checking that `path` is
defined. When a caller (e.g. `Menu.tsx` rendering the brand link) passes
`theme.brandLogoHref` that is `undefined`, the entire app crashes during
initialization with:
```
TypeError: Cannot read properties of undefined (reading 'startsWith')
```
This happens in real-world setups where a user partially overrides
`THEME_DEFAULT` / `THEME_DARK` in `superset_config.py` — Python replaces the
entire `token` dict rather than merging, so tokens like `brandLogoHref` end up
unset.
**Fix:** widen the parameter type to accept `null | undefined` and fall back
to the application root (or `'/'`) when the path is missing. The app stays
alive instead of going to a blank screen.
Fixes #39855
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
**Before:**
<!-- Add before screenshot -->
**After:**
<!-- Add after screenshot -->
### TESTING INSTRUCTIONS
Add this to `superset_config.py`:
```python
THEME_DARK = {
"token": {"brandLogoUrl":
"/static/assets/images/superset-logo-horiz.png"},
"algorithm": "dark",
}
```
1. Restart Superset and switch the UI to the **Dark** theme.
2. **Before the fix:** the page is blank and the console shows `Cannot read
properties of undefined (reading 'startsWith')`.
3. **After the fix:** the page loads normally; the brand link defaults to
the application root.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #39855
- [ ] 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: [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]