From ea1c7359ceb6736e0d276f311ae747b81fbe4a75 Mon Sep 17 00:00:00 2001 From: Fringg Date: Sun, 29 Mar 2026 02:56:54 +0300 Subject: [PATCH] fix: stabilize useMemo deps and add category search to sidebar - Use activeSection instead of activeTreeInfo as useMemo dependency (activeTreeInfo is derived from activeSection, new object each render) - Add category label matching to sidebar autocomplete search filter to match global search behavior --- src/components/admin/SettingsTreeSidebar.tsx | 2 ++ src/pages/AdminSettings.tsx | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/admin/SettingsTreeSidebar.tsx b/src/components/admin/SettingsTreeSidebar.tsx index 68ac48e..8454bae 100644 --- a/src/components/admin/SettingsTreeSidebar.tsx +++ b/src/components/admin/SettingsTreeSidebar.tsx @@ -56,6 +56,8 @@ export function SettingsTreeSidebar({ const translatedName = t(`admin.settings.settingNames.${formattedKey}`, formattedKey); if (translatedName.toLowerCase().includes(q)) return true; if (s.hint?.description?.toLowerCase().includes(q)) return true; + const categoryLabel = t(`admin.settings.categories.${s.category.key}`, s.category.key); + if (categoryLabel.toLowerCase().includes(q)) return true; return false; }) .slice(0, 8) diff --git a/src/pages/AdminSettings.tsx b/src/pages/AdminSettings.tsx index 955b9f4..857a289 100644 --- a/src/pages/AdminSettings.tsx +++ b/src/pages/AdminSettings.tsx @@ -106,7 +106,8 @@ export default function AdminSettings() { label: t(`admin.settings.categories.${key}`, key), settings, })); - }, [activeTreeInfo, allSettings, t]); + // eslint-disable-next-line react-hooks/exhaustive-deps -- activeTreeInfo derived from activeSection + }, [activeSection, allSettings, t]); // Filter settings for search - GLOBAL search across all settings const filteredSettings = useMemo(() => { @@ -168,7 +169,8 @@ export default function AdminSettings() { if (activeTreeInfo) return t(`admin.settings.tree.${activeTreeInfo.child.id}`); return t('admin.settings.title'); - }, [activeSection, activeTreeInfo, t]); + // eslint-disable-next-line react-hooks/exhaustive-deps -- activeTreeInfo derived from activeSection + }, [activeSection, t]); // Render content based on active section const renderContent = () => {