Copilot commented on code in PR #38644:
URL: https://github.com/apache/superset/pull/38644#discussion_r2935491248


##########
superset-frontend/src/theme/ThemeController.ts:
##########
@@ -743,6 +747,9 @@ export class ThemeController {
       return ThemeMode.DEFAULT;
     }
 
+    // Use explicit initial mode if provided (e.g. embedded dashboards default 
to light)
+    if (this.initialMode !== undefined) return this.initialMode;

Review Comment:
   `determineInitialMode()` returns `this.initialMode` without validating it. 
Since `ThemeController` can be constructed from plain JS (or with data coming 
from JSON), `initialMode` could be `null` or an unexpected string at runtime, 
which would set `currentMode` to an invalid value and persist it. Consider 
guarding with a null-check and `isValidThemeMode(...)` (and falling back to 
`ThemeMode.SYSTEM`/`DEFAULT` when invalid).
   



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