fix(web,admin,marketing): force dark statically instead of via next-themes
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),suppressHydrationWarningdropped where it only existed for next-themes' client-side attribute mutation.<Toaster theme="dark" />in web + admin — the shared@superset/uiToaster'suseTheme()fallback issystem, which would otherwise follow the OS on a forced-dark app.next-themesremoved from the three apps'package.json(@superset/uikeeps it for sonner).
Verified
tsc --noEmitclean in apps/web, apps/admin, apps/marketing;scripts/lint.shclean.- 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 keepsdarkand addscolorScheme: "dark". RemovedsuppressHydrationWarningwhere it only servednext-themes. - Removed
ThemeProviderand relatedTHEME_STORAGE_KEYusage; passedtheme="dark"to@superset/uiToasterin web/admin. - Dropped
next-themesfrom apppackage.json;@superset/uiretains it for sonner. - Review: confirm no
useThemeusage in these apps and that only@superset/uidepends onnext-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.