mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
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:
@@ -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)
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user