feat: add Aurora Glass built-in theme

This commit is contained in:
Linus Rath
2026-06-03 19:30:51 +02:00
parent 9953557af0
commit 9863b9d88e
3 changed files with 271 additions and 4 deletions
+16 -2
View File
@@ -451,11 +451,25 @@ export const useThemeStore = create<ThemeState>()(
onRehydrateStorage: () => {
return (state) => {
if (state) {
// Ensure built-in themes are always present after rehydration
// Ensure built-in themes are always present after rehydration.
// Drop persisted themes that were flagged builtIn but no longer
// exist in BUILTIN_THEMES (e.g. a built-in removed from source) so
// stale built-ins don't survive as phantom "user" themes.
const builtInIds = new Set(BUILTIN_THEMES.map(t => t.id));
const userThemes = state.installedThemes.filter(t => !builtInIds.has(t.id));
const userThemes = state.installedThemes.filter(
t => !builtInIds.has(t.id) && !t.builtIn
);
state.installedThemes = [...BUILTIN_THEMES, ...userThemes];
// If the active theme pointed at a now-removed built-in, fall back
// to the default so the UI doesn't reference a missing theme.
if (
state.activeThemeId &&
!state.installedThemes.some(t => t.id === state.activeThemeId)
) {
state.activeThemeId = null;
}
// Re-apply theme immediately after rehydration
const resolvedTheme = state.theme === 'system' ? getSystemTheme() : state.theme;
applyTheme(resolvedTheme);