improve robustness of appearance tab
This commit is contained in:
parent
b172f99835
commit
211a45b688
|
@ -119,7 +119,16 @@ const AppearanceTab = {
|
||||||
|
|
||||||
updateIndex('theme').then(themes => {
|
updateIndex('theme').then(themes => {
|
||||||
themes.forEach(([key, themePromise]) => themePromise.then(data => {
|
themes.forEach(([key, themePromise]) => themePromise.then(data => {
|
||||||
this.availableThemesV2.push({ key, data, name: data.name, version: 'v2' })
|
console.log('DEBUG', data)
|
||||||
|
if (!data) {
|
||||||
|
console.warn(`Theme with key ${key} is empty or malformed`)
|
||||||
|
} else if (Array.isArray(data)) {
|
||||||
|
console.warn(`Theme with key ${key} is a v1 theme and should be moved to static/palettes/index.json`)
|
||||||
|
} else if (!data.source && !data.theme) {
|
||||||
|
console.warn(`Theme with key ${key} is malformed`)
|
||||||
|
} else {
|
||||||
|
this.availableThemesV2.push({ key, data, name: data.name, version: 'v2' })
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ export default {
|
||||||
Object
|
Object
|
||||||
.values(themesIndex)
|
.values(themesIndex)
|
||||||
.forEach(themeFunc => {
|
.forEach(themeFunc => {
|
||||||
themeFunc().then(themeData => this.availableStyles.push(themeData))
|
themeFunc().then(themeData => themeData && this.availableStyles.push(themeData))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue