fix(sidebar): improve active child route matching logic (#170)

This commit is contained in:
Gabriel Jablonski 2025-12-20 18:12:27 -03:00 committed by GitHub
parent 0fd57d47d2
commit 331338b302
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -98,9 +98,11 @@ const activeChild = computed(() => {
return rankedPage ?? activeOnPages[0];
}
return navigableChildren.value.find(
child => child.to && route.path.startsWith(resolvePath(child.to))
);
return navigableChildren.value.find(child => {
if (!child.to) return false;
const childPath = resolvePath(child.to);
return route.path === childPath || route.path.startsWith(childPath + '/');
});
});
const hasActiveChild = computed(() => {