From a18b0e466d2632c539835b8aa2b04dfad6bb0f12 Mon Sep 17 00:00:00 2001 From: Dan Laugharn Date: Tue, 31 Mar 2026 07:14:12 -0500 Subject: [PATCH] fix: handle undefined href in NavLink to prevent crash with DocMeta items NavLink crashed with "Cannot read properties of undefined (reading 'startsWith')" when DocMeta items without an href property reached the component. Normalize href to "#" when falsy so startsWith and the Link component both receive a valid string. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/fromsrc/src/components/navlink.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/fromsrc/src/components/navlink.tsx b/packages/fromsrc/src/components/navlink.tsx index 8eb27094..4d31efa6 100644 --- a/packages/fromsrc/src/components/navlink.tsx +++ b/packages/fromsrc/src/components/navlink.tsx @@ -14,12 +14,13 @@ export interface NavLinkProps { } function NavLinkComponent({ - href, + href: rawHref, children, icon, onClick, external, }: NavLinkProps): JSX.Element { + const href = rawHref || "#"; const pathname = usePathname(); const isActive = pathname === href; const ref = useRef(null);