aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-10-26 14:28:27 +0200
committerVendicated <vendicated@riseup.net>2022-10-26 14:28:27 +0200
commitb87f0bf3f96dce3c51f0b571e55d5d131af1d3f2 (patch)
treebac6698fb66c31732f51c10d6260cacd2a5ff98d
parent670b7d7d01c9cafb8176f36d4d4d5e7268f67e68 (diff)
downloadVencord-b87f0bf3f96dce3c51f0b571e55d5d131af1d3f2.tar.gz
Vencord-b87f0bf3f96dce3c51f0b571e55d5d131af1d3f2.tar.bz2
Vencord-b87f0bf3f96dce3c51f0b571e55d5d131af1d3f2.zip
Settings: Cache default value
-rw-r--r--src/api/settings.ts10
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;