fix(themes): changing theme would bug out

This commit is contained in:
Tom (plebeius.eth)
2024-06-22 12:36:38 +02:00
parent 1a22ac5068
commit 032ba62cbe
2 changed files with 34 additions and 24 deletions
+2 -1
View File
@@ -5,7 +5,7 @@ interface ThemeState {
themes: Record<string, string>;
setTheme: (subplebbitAddress: string, theme: string) => void;
getTheme: (subplebbitAddress: string) => string | null;
loadThemes: () => void;
loadThemes: () => Promise<void>;
}
const themeStore = localForageLru.createInstance({
@@ -35,6 +35,7 @@ const useThemeStore = create<ThemeState>((set: StoreApi<ThemeState>['setState'],
},
}));
// Load themes on store initialization
useThemeStore.getState().loadThemes();
export default useThemeStore;