bito-code-review[bot] commented on code in PR #37378:
URL: https://github.com/apache/superset/pull/37378#discussion_r2775446007
##########
superset-frontend/src/theme/ThemeController.ts:
##########
@@ -551,18 +562,32 @@ export class ThemeController {
this.persistMode();
this.notifyListeners();
} catch (error) {
- console.error('Failed to update theme:', error);
- this.fallbackToDefaultMode();
+ await this.fallbackToDefaultMode();
}
}
/**
- * Fallback to default mode with error recovery.
+ * Fallback to default mode with runtime error recovery.
+ * Tries to fetch a fresh system default theme from the API.
*/
- private fallbackToDefaultMode(): void {
+ private async fallbackToDefaultMode(): Promise<void> {
Review Comment:
<!-- Bito Reply -->
This design choice effectively addresses the recursion issue by having
`applyThemeWithRecovery` propagate errors to `updateTheme`, which handles async
fallback internally. Keeping `setThemeMode` synchronous provides a simpler API,
with fire-and-forget behavior ensuring errors are managed asynchronously
without blocking the caller.
--
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]