diff options
author | Vendicated <vendicated@riseup.net> | 2022-10-26 14:28:27 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-10-26 14:28:27 +0200 |
commit | b87f0bf3f96dce3c51f0b571e55d5d131af1d3f2 (patch) | |
tree | bac6698fb66c31732f51c10d6260cacd2a5ff98d /src/api/settings.ts | |
parent | 670b7d7d01c9cafb8176f36d4d4d5e7268f67e68 (diff) | |
download | Vencord-b87f0bf3f96dce3c51f0b571e55d5d131af1d3f2.tar.gz Vencord-b87f0bf3f96dce3c51f0b571e55d5d131af1d3f2.tar.bz2 Vencord-b87f0bf3f96dce3c51f0b571e55d5d131af1d3f2.zip |
Settings: Cache default value
Diffstat (limited to 'src/api/settings.ts')
-rw-r--r-- | src/api/settings.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/api/settings.ts b/src/api/settings.ts index 5d581c6..e25572f 100644 --- a/src/api/settings.ts +++ b/src/api/settings.ts @@ -76,9 +76,13 @@ function makeProxy(settings: Settings, root = settings, path = ""): Settings { if (!setting) return v; if ("default" in setting) // normal setting with a default value - return setting.default; - if (setting.type === OptionType.SELECT) - return setting.options.find(o => o.default)?.value; + return (target[p] = setting.default); + if (setting.type === OptionType.SELECT) { + const def = setting.options.find(o => o.default); + if (def) + target[p] = def.value; + return def?.value; + } } } return v; |