@@ -341,6 +341,8 @@ export const useWidthToggle = () => {
341341// Create context for doc navigation (prev/next)
342342type DocNavItem = { label : React . ReactNode ; to : string }
343343const DocNavigationContext = React . createContext < {
344+ libraryId : LibraryId
345+ version : string
344346 prevItem ?: DocNavItem
345347 nextItem ?: DocNavItem
346348 colorFrom : string
@@ -356,7 +358,15 @@ export function DocNavigation() {
356358 const context = useDocNavigation ( )
357359 if ( ! context ) return null
358360
359- const { prevItem, nextItem, colorFrom, colorTo, textColor } = context
361+ const {
362+ libraryId,
363+ version,
364+ prevItem,
365+ nextItem,
366+ colorFrom,
367+ colorTo,
368+ textColor,
369+ } = context
360370
361371 if ( ! prevItem && ! nextItem ) return null
362372
@@ -368,7 +378,7 @@ export function DocNavigation() {
368378 as = { Link }
369379 from = "/$libraryId/$version/docs"
370380 to = { prevItem . to }
371- params
381+ params = { { libraryId , version } as never }
372382 className = "py-1 px-2 sm:py-2 sm:px-3 flex items-center gap-1 sm:gap-2"
373383 >
374384 < ChevronLeft className = "w-3 h-3 sm:w-4 sm:h-4" />
@@ -387,7 +397,7 @@ export function DocNavigation() {
387397 as = { Link }
388398 from = "/$libraryId/$version/docs"
389399 to = { nextItem . to }
390- params
400+ params = { { libraryId , version } as never }
391401 className = "py-1 px-2 sm:py-2 sm:px-3 flex items-center gap-1 sm:gap-2"
392402 >
393403 < div className = "flex flex-col items-end" >
@@ -651,6 +661,10 @@ export function DocsLayout({
651661 < ul className = "text-[.85em] leading-snug list-none" >
652662 { group ?. children ?. map ( ( child , i ) => {
653663 const linkClasses = `flex gap-2 items-center justify-between group px-2 py-1.5 rounded-lg hover:bg-gray-500/10 opacity-60 hover:opacity-100`
664+ const linkParams =
665+ ! child . to . startsWith ( '/' ) || child . to . includes ( '/$libraryId' )
666+ ? ( { libraryId, version } as never )
667+ : undefined
654668
655669 return (
656670 < li key = { i } >
@@ -667,7 +681,7 @@ export function DocsLayout({
667681 < Link
668682 from = "/$libraryId/$version/docs"
669683 to = { child . to }
670- params
684+ params = { linkParams }
671685 onClick = { ( ) => {
672686 detailsRef . current . removeAttribute ( 'open' )
673687 } }
@@ -877,7 +891,15 @@ export function DocsLayout({
877891 return (
878892 < WidthToggleContext . Provider value = { { isFullWidth, setIsFullWidth } } >
879893 < DocNavigationContext . Provider
880- value = { { prevItem, nextItem, colorFrom, colorTo, textColor } }
894+ value = { {
895+ libraryId,
896+ version,
897+ prevItem,
898+ nextItem,
899+ colorFrom,
900+ colorTo,
901+ textColor,
902+ } }
881903 >
882904 < div
883905 className = { `
0 commit comments