You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ThemeProvider: stop bundling the legacy JS theme with the root entry #8722
Part of #8676 (P2). Breaking change. This needs a decision on major-version timing before anyone starts.
Problem
ThemeProvider.tsx:5 imports theme.ts, which imports legacy-theme/ts/color-schemes.ts (327 KB of source). index.ts:3 also exports theme. Every consumer of the root entry therefore ships and evaluates the legacy theme.
Measured: with esbuild on theme.ts alone:
275 KB minified.
20 KB gzipped. The gzipped size is small because the data repeats, but parse and evaluation cost follows the 275 KB.
The per-provider deepmerge(theme, scheme) is cheap: 0.4 to 0.6 ms warm and 1.5 to 3 ms on the first call.
@primer/react/next already avoids the theme import, and the root ThemeProvider is deprecated in favor of it.
Proposed approach
Decide which major release removes the default theme from the root ThemeProvider and the root theme export.
Ship a migration path, either @primer/react/next or an explicit theme prop import.
Activity