Repository navigation
Studio: follow OS theme by default and apply it on mount - #6405
Conversation
Set ThemeProvider defaultTheme to "system" and enable system preference so the app follows the OS theme. In the theme store, apply the resolved theme to the document immediately on mount so the store is the single source of truth and avoids an initial light flash on fresh origins (e.g. empty localStorage). Minor comment and formatting tweaks in setTheme were also made.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Code Review
This pull request updates the application's theme provider to use the system theme by default and ensures the theme store acts as the single source of truth by applying the stored theme on mount. Feedback is provided to optimize the theme application inside the subscription callback by checking if the theme class is already present on the document, preventing redundant DOM manipulations.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Summary
The Studio frontend now defaults to the OS theme instead of light, and the theme store applies the resolved theme to the document on mount. This removes the initial light flash on fresh origins where
localStorageis empty.Changes
studio/frontend/src/app/provider.tsx:338: setThemeProvidertodefaultTheme="system"withenableSystem, so the app follows the OS light/dark preference.studio/frontend/src/features/settings/stores/theme-store.ts:53: applyresolveTheme(readStoredTheme())to the document on subscribe (mount), making the store the single source of truth for the DOM class. Previously the initial paint relied solely on next-themes, which on a fresh origin (e.g. a new Cloudflare--securelink with emptylocalStorage) fell back to its own default and showed light while the control still read "system".setThemeafter dropping thedefaultTheme="light"reference.