The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Load the whitelabel settings pages lazily (#80788)
Romeo Van Snick7c8f7b450ba1
diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/index.ts b/enterprise/frontend/src/metabase-enterprise/whitelabel/index.tsindex e64b6307176..2d63d083d17 100644--- a/enterprise/frontend/src/metabase-enterprise/whitelabel/index.ts+++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/index.ts@@ -24,8 +24,10 @@ import type { SettingKey } from "metabase-types/api";import { LandingPageUrlField } from "./components/LandingPageUrlField";import { LogoIcon } from "./components/LogoIcon";-import { WhiteLabelBrandingSettingsPage } from "./components/WhiteLabelBrandingSettingsPage";-import { WhiteLabelConcealSettingsPage } from "./components/WhiteLabelConcealSettingsPage";+import {+ LazyWhiteLabelBrandingSettingsPage,+ LazyWhiteLabelConcealSettingsPage,+} from "./lazy";import { updateColors } from "./lib/whitelabel";/**@@ -42,9 +44,9 @@ export function initializePlugin() {};PLUGIN_WHITELABEL.WhiteLabelBrandingSettingsPage =- WhiteLabelBrandingSettingsPage;+ LazyWhiteLabelBrandingSettingsPage;PLUGIN_WHITELABEL.WhiteLabelConcealSettingsPage =- WhiteLabelConcealSettingsPage;+ LazyWhiteLabelConcealSettingsPage;PLUGIN_APP_INIT_FUNCTIONS.push(() => {updateColors();diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/lazy.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/lazy.tsxnew file mode 100644index 00000000000..cfbac743702--- /dev/null+++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/lazy.tsx@@ -0,0 +1,42 @@+import { Suspense, lazy } from "react";++import { DelayedLoadingSpinner } from "metabase/common/components/DelayedLoading";++/**+ * The whitelabel settings pages, in their own chunk.+ *+ * The branding page renders the colour pickers, which carry `react-color` and+ * its colour helpers. Nothing else on first paint needs them: every other colour+ * picker in the app reaches a lighter part of `ColorPicker`, so these two pages+ * are what held that stack in the shared vendor chunk.+ *+ * `PLUGIN_WHITELABEL` holds components rather than route loaders, so the+ * Suspense boundary lives here rather than at the call site.+ */+const BrandingSettingsPage = lazy(() =>+ import("./components/WhiteLabelBrandingSettingsPage").then(+ ({ WhiteLabelBrandingSettingsPage }) => ({+ default: WhiteLabelBrandingSettingsPage,+ }),+ ),+);++const ConcealSettingsPage = lazy(() =>+ import("./components/WhiteLabelConcealSettingsPage").then(+ ({ WhiteLabelConcealSettingsPage }) => ({+ default: WhiteLabelConcealSettingsPage,+ }),+ ),+);++export const LazyWhiteLabelBrandingSettingsPage = () => (+ <Suspense fallback={<DelayedLoadingSpinner />}>+ <BrandingSettingsPage />+ </Suspense>+);++export const LazyWhiteLabelConcealSettingsPage = () => (+ <Suspense fallback={<DelayedLoadingSpinner />}>+ <ConcealSettingsPage />+ </Suspense>+);