korbit-ai[bot] commented on code in PR #34218:
URL: https://github.com/apache/superset/pull/34218#discussion_r2214504731
##########
superset-frontend/src/theme/ThemeController.ts:
##########
@@ -329,8 +333,12 @@ export class ThemeController {
* Initializes media query listeners if OS preference is allowed
*/
private initializeMediaQueryListener(): void {
- this.mediaQuery = window.matchMedia(MEDIA_QUERY_DARK_SCHEME);
- this.mediaQuery.addEventListener('change', this.handleSystemThemeChange);
+ try {
+ this.mediaQuery = window.matchMedia(MEDIA_QUERY_DARK_SCHEME);
+ this.mediaQuery.addEventListener('change', this.handleSystemThemeChange);
+ } catch (error) {
+ console.warn('Failed to initialize media query listener:', error);
Review Comment:
### Critical Media Query Init Warning <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
Critical initialization failure is only logged at WARN level without
structured data.
###### Why this matters
Media query initialization failures affect core theme functionality and
should be logged at ERROR level with structured data for proper monitoring.
###### Suggested change ∙ *Feature Preview*
```typescript
console.error({
message: 'Failed to initialize media query listener',
error: error instanceof Error ? error.message : String(error),
stack: error instanceof Error ? error.stack : undefined,
component: 'ThemeController',
method: 'initializeMediaQueryListener'
});
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5cce1795-525d-4803-a0f5-25a2297d2316/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5cce1795-525d-4803-a0f5-25a2297d2316?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5cce1795-525d-4803-a0f5-25a2297d2316?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5cce1795-525d-4803-a0f5-25a2297d2316?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/5cce1795-525d-4803-a0f5-25a2297d2316)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:bed7db38-8e59-49be-a6d3-207a5f1c9d59 -->
[](bed7db38-8e59-49be-a6d3-207a5f1c9d59)
--
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]