fix: don't save dynamic themes
This commit is contained in:
1 parent
d820f1e242
commit
c66941d342
1 file changed
+13
-2
+13
-2
@@ -112,7 +112,14 @@ export let themeData = writable<ThemeData>(
|
|||||||
|
|
||||||
themeData.subscribe((themeData) => {
|
themeData.subscribe((themeData) => {
|
||||||
if (browser) {
|
if (browser) {
|
||||||
localStorage.setItem('themeData', JSON.stringify(themeData))
|
const filteredThemes = themeData.themes.filter((t) => t.id > 0)
|
||||||
|
localStorage.setItem(
|
||||||
|
'themeData',
|
||||||
|
JSON.stringify({
|
||||||
|
...themeData,
|
||||||
|
themes: filteredThemes,
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -189,7 +196,11 @@ function loadTheme() {
|
|||||||
const localTheme = localStorage.getItem('themeData')
|
const localTheme = localStorage.getItem('themeData')
|
||||||
|
|
||||||
if (localTheme) {
|
if (localTheme) {
|
||||||
return JSON.parse(localTheme)
|
const data = JSON.parse(localTheme)
|
||||||
|
if (!data) return
|
||||||
|
console.log(data)
|
||||||
|
data.themes = [...presets, ...data.themes]
|
||||||
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in new issue
Block a user