Skip to content

Commit 2a603c0

Browse files
Netero98Daniil Stepanov
andauthored
Fix strict comparison between current page URL and navigation item URL. Strict comparison broke active navbar highlighting when a query parameter was added to the URL. (#115)
Co-authored-by: Daniil Stepanov <[email protected]>
1 parent 6266b91 commit 2a603c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

resources/js/components/nav-main.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ export function NavMain({ items = [] }: { items: NavItem[] }) {
1010
<SidebarMenu>
1111
{items.map((item) => (
1212
<SidebarMenuItem key={item.title}>
13-
<SidebarMenuButton
14-
asChild isActive={item.href === page.url}
13+
<SidebarMenuButton
14+
asChild
15+
isActive={page.url.startsWith(item.href)}
1516
tooltip={{ children: item.title }}
1617
>
1718
<Link href={item.href} prefetch>

0 commit comments

Comments
 (0)