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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user