bito-code-review[bot] commented on code in PR #37059:
URL: https://github.com/apache/superset/pull/37059#discussion_r2682828206
##########
superset/views/base.py:
##########
@@ -567,9 +567,28 @@ def get_spa_template_context(
"""
payload = get_spa_payload(extra_bootstrap_data)
- # Extract theme data for template access
- theme_data = get_theme_bootstrap_data().get("theme", {})
+ # Extract theme data from payload (this is what gets sent to frontend)
+ theme_data = payload.get("common", {}).get("theme", {})
default_theme = theme_data.get("default", {})
+ dark_theme = theme_data.get("dark", {})
+
+ # Apply brandAppName fallback to both default and dark themes
+ # Priority: theme brandAppName > APP_NAME config > "Superset" default
+ app_name_from_config = app.config.get("APP_NAME", "Superset")
+ for theme_config in [default_theme, dark_theme]:
+ if not theme_config:
+ continue
+ theme_tokens = theme_config.get("token", {})
+ if (
+ not theme_tokens.get("brandAppName")
+ or theme_tokens.get("brandAppName") == "Superset"
+ ):
+ # If brandAppName not set or is default, check if APP_NAME
customized
+ if app_name_from_config != "Superset":
+ # User has customized APP_NAME, use it as brandAppName
+ theme_tokens["brandAppName"] = app_name_from_config
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Data consistency issue</b></div>
<div id="fix">
The brandAppName fallback modifies theme_tokens in place, which affects the
cached theme data shared across requests. This can lead to inconsistent app
names being displayed. Use copy.deepcopy on theme_data to isolate changes to
this request.
</div>
</div>
<small><i>Code Review Run #4bcc1d</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]