From 1d01ccfc40024b0803577d1dc8f43433afd468b1 Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Wed, 22 Nov 2023 09:39:29 +1100 Subject: [PATCH] fixed theme selected dissapearing after reload in menu --- interface/src/components/ThemeSelector.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/interface/src/components/ThemeSelector.tsx b/interface/src/components/ThemeSelector.tsx index 5e012922..dfee00cd 100644 --- a/interface/src/components/ThemeSelector.tsx +++ b/interface/src/components/ThemeSelector.tsx @@ -22,14 +22,18 @@ const ThemeSelector = ({ selectedType, setSelectedType, isEditMode }: ThemeSelec useEffect(() => { const initializeThemes = async () => { - const downloaded = (await listThemes()).themes; + const downloaded = (await listThemes()); const initializedThemes = themesList.map(theme => ({ ...theme, - isDownloaded: downloaded.includes(theme.name), + isDownloaded: downloaded.themes.includes(theme.name), isLoading: false })); + if (downloaded.selectedTheme !== '') { + setEnabledThemeName(downloaded.selectedTheme); + } + initializedThemes.sort((a, b) => Number(b.isDownloaded) - Number(a.isDownloaded)); setThemes(initializedThemes);