Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions superset-frontend/src/components/CrudThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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>
Expand Down
Loading