Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/web/src/hooks/useTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@ export function useTheme() {
const setTheme = useCallback((next: Theme): boolean => {
if (typeof window === "undefined") return false;
try {
// Preserve the current mode before replacing a legacy or inferred theme
// preference. Otherwise a fresh System preference is re-inferred from
// the new theme's base appearance, which can switch a dark UI to light.
writeAppearanceModePreference(readAppearanceModePreference(getStored()));
// Choosing a whole theme replaces any automatic-mode mix. The mix is
// captured first so a failed preference write can put it back instead
// of erasing it or leaving it attached to the new theme.
Expand Down
Loading