rusackas opened a new pull request, #43019: URL: https://github.com/apache/superset/pull/43019
Follow-up to #41347. ### SUMMARY #41347 fixed a white-screen crash caused by a partial `THEME_DEFAULT`/`THEME_DARK` override in `superset_config.py`, where an unset token (e.g. `fontFamily`) reached `.startsWith()` in the frontend as `undefined`. `ensureStaticPrefix()` in `superset-frontend/src/utils/assetUrl.ts` has the same unconditional `.startsWith()` call. Its callers in `Menu.tsx` pass `theme.brandLogoUrl` and `brand.icon`, both typed as required `string` fields — but a partial theme reaching the frontend from a source other than `superset_config.py` (e.g. a DB-stored theme created via the API) can still leave these fields unset at runtime, reproducing the same crash for a different theme source. This adds a null/undefined guard to `ensureStaticPrefix()` so it returns `undefined` instead of throwing when handed a missing value, mirroring the existing `ensureAppRoot()` null-safety pattern in `pathUtils.ts`. ### BEFORE/AFTER **Before:** A theme missing `brandLogoUrl` or `brand.icon` (e.g. incompletely configured via a non-`superset_config.py` source) crashes on `ensureStaticPrefix(undefined).startsWith(...)`. **After:** `ensureStaticPrefix(undefined)` returns `undefined` instead of throwing, letting the image render without a `src` rather than crashing the page. ### TESTING INSTRUCTIONS ```bash npm run test -- src/utils/assetUrl.test.ts ``` Added two unit tests covering `null` and `undefined` inputs. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [x] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 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]
