mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fixed theme selected dissapearing after reload in menu
This commit is contained in:
@@ -22,14 +22,18 @@ const ThemeSelector = ({ selectedType, setSelectedType, isEditMode }: ThemeSelec
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const initializeThemes = async () => {
|
const initializeThemes = async () => {
|
||||||
const downloaded = (await listThemes()).themes;
|
const downloaded = (await listThemes());
|
||||||
|
|
||||||
const initializedThemes = themesList.map(theme => ({
|
const initializedThemes = themesList.map(theme => ({
|
||||||
...theme,
|
...theme,
|
||||||
isDownloaded: downloaded.includes(theme.name),
|
isDownloaded: downloaded.themes.includes(theme.name),
|
||||||
isLoading: false
|
isLoading: false
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
if (downloaded.selectedTheme !== '') {
|
||||||
|
setEnabledThemeName(downloaded.selectedTheme);
|
||||||
|
}
|
||||||
|
|
||||||
initializedThemes.sort((a, b) => Number(b.isDownloaded) - Number(a.isDownloaded));
|
initializedThemes.sort((a, b) => Number(b.isDownloaded) - Number(a.isDownloaded));
|
||||||
|
|
||||||
setThemes(initializedThemes);
|
setThemes(initializedThemes);
|
||||||
|
|||||||
Reference in New Issue
Block a user