Fix saving a config that did not require schema migration

This commit is contained in:
Jakub Okoński 2020-03-31 17:11:26 +02:00
parent b5706d9dd0
commit 442b36551a

View file

@ -1471,9 +1471,12 @@ export async function update() {
const updatetest = v => { const updatetest = v => {
return updaters.hasOwnProperty(v) && updaters[v] instanceof Function return updaters.hasOwnProperty(v) && updaters[v] instanceof Function
} }
let updated = false
while (updatetest(get("configversion"))) { while (updatetest(get("configversion"))) {
await updaters[get("configversion")]() await updaters[get("configversion")]()
updated = true
} }
return updated
} }
/** Read all user configuration from storage API then notify any waiting asynchronous calls /** Read all user configuration from storage API then notify any waiting asynchronous calls
@ -1494,8 +1497,10 @@ async function init() {
schlepp(localConfig[CONFIGNAME]) schlepp(localConfig[CONFIGNAME])
} }
await update() const configUpdated = await update()
await save() if (configUpdated)
await save()
INITIALISED = true INITIALISED = true
for (const waiter of WAITERS) { for (const waiter of WAITERS) {
waiter() waiter()