fix: Home icon active state — exact match "/" instead of startsWith

matchPaths: ['/'] with startsWith('/') matched every route,
keeping Home highlighted on all pages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-22 19:32:55 +00:00
parent 2bcd3e2f3c
commit dfbb51b582

View File

@@ -160,7 +160,9 @@ export function Sidebar() {
/* ── Active detection ─────────────────────────────── */
const isActive = (item: NavEntry) => {
if (item.matchPaths) return item.matchPaths.some(p => location.pathname.startsWith(p))
if (item.matchPaths) return item.matchPaths.some(p =>
p === '/' ? location.pathname === '/' : location.pathname.startsWith(p)
)
if (item.href === '/') return location.pathname === '/'
return location.pathname.startsWith(item.href)
}