From 022ee030d6e1cf533032770794bc78747db4cc6d Mon Sep 17 00:00:00 2001 From: cocobo1 Date: Fri, 14 Nov 2025 18:34:32 +0200 Subject: [PATCH] settings: fix settings ui --- src/lib/ui/settings/patches/tabs.tsx | 33 +++++++++++++++++----------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/lib/ui/settings/patches/tabs.tsx b/src/lib/ui/settings/patches/tabs.tsx index afe93b5..04d341d 100644 --- a/src/lib/ui/settings/patches/tabs.tsx +++ b/src/lib/ui/settings/patches/tabs.tsx @@ -80,19 +80,26 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) { }); }); - unpatches.push(after("default", SettingsOverviewScreen, (_, ret) => { - if (useIsFirstRender()) return; // :shrug: - - const { sections } = findInReactTree(ret, i => i.props?.sections).props; - // Credit to @palmdevs - https://discord.com/channels/1196075698301968455/1243605828783571024/1307940348378742816 - let index = -~sections.findIndex((i: any) => i.settings.includes("ACCOUNT")) || 1; +const createListModule = findByPropsLazy("createList"); +unpatches.push(after("createList", createListModule, function(args, ret) { + const [config] = args; + + if (config?.sections && Array.isArray(config.sections)) { + const sections = config.sections; + let index = -~sections.findIndex((i: any) => i.settings?.includes("ACCOUNT")) || 1; + Object.keys(registeredSections).forEach(sect => { - sections.splice(index++, 0, { - label: sect, - title: sect, - settings: registeredSections[sect].map(a => a.key) - }); + const alreadyExists = sections.some((s: any) => s.label === sect); + if (!alreadyExists) { + sections.splice(index++, 0, { + label: sect, + title: sect, + settings: registeredSections[sect].map(a => a.key) + }); + } }); - })); -} + } + + return ret; +}))}; \ No newline at end of file