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
This commit is contained in:
Fringg
2026-03-29 02:56:54 +03:00
parent 21813ef82e
commit ea1c7359ce
2 changed files with 6 additions and 2 deletions

View File

@@ -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)

View File

@@ -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 = () => {