From 719c6140f3fafb0ae04323268651f0b4f919af91 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Tue, 14 May 2024 21:18:43 +0200 Subject: [PATCH] fix Vencord Settings section being added multiple times --- src/plugins/_core/settings.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index 0a6aea8..b09af2c 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -154,6 +154,8 @@ export default definePlugin({ if (settingsLocation === "bottom") return firstChild === "LOGOUT"; if (settingsLocation === "belowActivity") return firstChild === "CHANGELOG"; + if (!header) return; + const names = { top: i18n.Messages.USER_SETTINGS, aboveNitro: i18n.Messages.BILLING_SETTINGS, @@ -163,8 +165,12 @@ export default definePlugin({ return header === names[settingsLocation]; }, + patchedSettings: new WeakSet(), + addSettings(elements: any[], element: { header?: string; settings: string[]; }, sectionTypes: Record) { - if (!this.isRightSpot(element)) return; + if (this.patchedSettings.has(elements) || !this.isRightSpot(element)) return; + + this.patchedSettings.add(elements); elements.push(...this.makeSettingsCategories(sectionTypes)); },