fix: theme setting miss after refreshing

This commit is contained in:
jialin
2025-05-15 11:53:10 +08:00
parent 2e56e93d83
commit 5e8692eae5
8 changed files with 49 additions and 28 deletions
+7 -2
View File
@@ -9,12 +9,17 @@ type UserSettings = {
isDarkTheme: boolean;
};
export const userSettingsAtom = atomWithStorage<UserSettings>('userSettings', {
const defaultSettings: UserSettings = {
theme: 'light',
mode: 'auto',
isDarkTheme: false,
colorPrimary: colorPrimary
});
};
export const userSettingsAtom = atomWithStorage<UserSettings>(
'userSettings',
defaultSettings
);
export const userSettingsHelperAtom = atom(
(get) => get(userSettingsAtom),