RefLink() — supabase Function Reference
Architecture documentation for the RefLink() function in Reference.navigation.client.tsx from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD d1f6b481_4d95_506c_d33c_bbd8c6c3debd["RefLink()"] cac0806c_afea_1c54_1d56_95246f1e7737["useCurrentPathname()"] d1f6b481_4d95_506c_d33c_bbd8c6c3debd -->|calls| cac0806c_afea_1c54_1d56_95246f1e7737 64d636ac_c75e_381b_df7f_d60397061232["deriveHref()"] d1f6b481_4d95_506c_d33c_bbd8c6c3debd -->|calls| 64d636ac_c75e_381b_df7f_d60397061232 5421e3b4_c81a_c353_8378_0414da07f5d9["getLinkStyles()"] d1f6b481_4d95_506c_d33c_bbd8c6c3debd -->|calls| 5421e3b4_c81a_c353_8378_0414da07f5d9 ad13a905_2281_561d_52cd_61e34d97c40b["createReferenceSubsectionNavigator()"] d1f6b481_4d95_506c_d33c_bbd8c6c3debd -->|calls| ad13a905_2281_561d_52cd_61e34d97c40b style d1f6b481_4d95_506c_d33c_bbd8c6c3debd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/docs/features/docs/Reference.navigation.client.tsx lines 240–294
export function RefLink({
basePath,
section,
skipChildren = false,
className,
}: {
basePath: string
section: AbbrevApiReferenceSection
skipChildren?: boolean
className?: string
}) {
const ref = useRef<HTMLAnchorElement>(null)
const pathname = useCurrentPathname()
const href = deriveHref(basePath, section)
const isActive =
pathname === href || (pathname === basePath && href.replace(basePath, '') === '/introduction')
useEffect(() => {
if (ref.current) {
ref.current.ariaCurrent = isActive ? 'page' : null
ref.current.className = getLinkStyles(isActive, className)
}
}, [isActive, className])
const onClick = useCallback(
(evt: MouseEvent) => createReferenceSubsectionNavigator(href, section.slug)(evt),
[href, section.slug]
)
if (!('title' in section)) return null
const isCompoundSection =
!skipChildren && 'items' in section && section.items && section.items.length > 0
return (
<>
{isCompoundSection ? (
<CompoundRefLink basePath={basePath} section={section} />
) : (
<Link
ref={ref}
// We don't use these links because we never do real navigation, so
// prefetching just wastes egress
prefetch={false}
href={href}
className={getLinkStyles(isActive, className)}
onClick={onClick}
>
{section.title}
</Link>
)}
</>
)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does RefLink() do?
RefLink() is a function in the supabase codebase.
What does RefLink() call?
RefLink() calls 4 function(s): createReferenceSubsectionNavigator, deriveHref, getLinkStyles, useCurrentPathname.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free