Settings: Cache default value
This commit is contained in:
parent
670b7d7d01
commit
b87f0bf3f9
@ -76,9 +76,13 @@ function makeProxy(settings: Settings, root = settings, path = ""): Settings {
|
|||||||
if (!setting) return v;
|
if (!setting) return v;
|
||||||
if ("default" in setting)
|
if ("default" in setting)
|
||||||
// normal setting with a default value
|
// normal setting with a default value
|
||||||
return setting.default;
|
return (target[p] = setting.default);
|
||||||
if (setting.type === OptionType.SELECT)
|
if (setting.type === OptionType.SELECT) {
|
||||||
return setting.options.find(o => o.default)?.value;
|
const def = setting.options.find(o => o.default);
|
||||||
|
if (def)
|
||||||
|
target[p] = def.value;
|
||||||
|
return def?.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
|
Loading…
Reference in New Issue
Block a user