You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2025/09/18 03:49:32 UTC

(superset) branch master updated: fix(CrudThemeProvider): Optimized theme loading logic (#35155)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 1bf112a57a fix(CrudThemeProvider): Optimized theme loading logic (#35155)
1bf112a57a is described below

commit 1bf112a57a36b341520b6018a8aecb7f47d52057
Author: marun <ma...@163.com>
AuthorDate: Thu Sep 18 11:49:26 2025 +0800

    fix(CrudThemeProvider): Optimized theme loading logic (#35155)
---
 superset-frontend/src/components/CrudThemeProvider.tsx | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/src/components/CrudThemeProvider.tsx b/superset-frontend/src/components/CrudThemeProvider.tsx
index aa6ddab3fa..9e62902aa0 100644
--- a/superset-frontend/src/components/CrudThemeProvider.tsx
+++ b/superset-frontend/src/components/CrudThemeProvider.tsx
@@ -19,6 +19,7 @@
 import { ReactNode, useEffect, useState } from 'react';
 import { useThemeContext } from 'src/theme/ThemeProvider';
 import { Theme } from '@superset-ui/core';
+import { Loading } from '@superset-ui/core/components';
 
 interface CrudThemeProviderProps {
   children: ReactNode;
@@ -62,11 +63,16 @@ export default function CrudThemeProvider({
     }
   }, [themeId, globalThemeContext]);
 
-  // If no dashboard theme, just render children (they use global theme)
-  if (!themeId || !dashboardTheme) {
+  // If no themeId, just render children (they use global theme)
+  if (!themeId) {
     return <>{children}</>;
   }
 
+  // If themeId exists, but theme is not loaded yet, return null to prevent re-mounting children
+  if (!dashboardTheme) {
+    return <Loading />;
+  }
+
   // Render children with the dashboard theme provider from controller
   return (
     <dashboardTheme.SupersetThemeProvider>