fix(web,admin,marketing): force dark statically instead of via next-themes

KI
1mo ago
+12-52

Why

Next 16.2 / React 19.2 dev console error on every page of web/admin/marketing:
Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. — raised from Providers → ThemeProvider.

next-themes injects an inline <script> to apply the theme before paint; React 19.2 now flags that whenever the provider renders on the client. Upstream bugs pacocoursey/next-themes#385 #387 #397 are open with no release since 0.4.6, so there is nothing to bump to.

What

All three apps pin forcedTheme="dark" and nothing in them calls useTheme, so the provider was dead weight whose only output was the offending script.

  • <html className="dark" style={{ colorScheme: "dark" }}> in web + admin (marketing already had the class; gains color-scheme parity), suppressHydrationWarning dropped where it only existed for next-themes' client-side attribute mutation.
  • <Toaster theme="dark" /> in web + admin — the shared @superset/ui Toaster's useTheme() fallback is system, which would otherwise follow the OS on a forced-dark app.
  • next-themes removed from the three apps' package.json (@superset/ui keeps it for sonner).

Verified

  • tsc --noEmit clean in apps/web, apps/admin, apps/marketing; scripts/lint.sh clean.
  • Net −38 lines.

Summary by cubic

Forces dark mode statically across apps/web, apps/admin, and apps/marketing, removing next-themes to eliminate the React 19.2/Next 16.2 console error from the provider’s inline script. Old: ThemeProvider with forcedTheme="dark"; new: <html className="dark" style={{ colorScheme: 'dark' }}> and theme="dark" on the shared Toaster, with no UI changes besides consistent dark toasts and no hydration warnings.

  • Set <html className="dark" style={{ colorScheme: "dark" }}> in web/admin; marketing keeps dark and adds colorScheme: "dark". Removed suppressHydrationWarning where it only served next-themes.
  • Removed ThemeProvider and related THEME_STORAGE_KEY usage; passed theme="dark" to @superset/ui Toaster in web/admin.
  • Dropped next-themes from app package.json; @superset/ui retains it for sonner.
  • Review: confirm no useTheme usage in these apps and that only @superset/ui depends on next-themes. No migrations required.

Summary by CodeRabbit

  • Style

    • Standardized the admin, marketing, and web experiences to consistently use dark mode.
    • Updated notifications and document color settings for a more consistent dark-theme appearance.
  • Refactor

    • Simplified theme handling across the applications.
    • Removed theme switching and related configuration no longer needed.