11'use client' ;
22
3- import { useBrowseNavigation } from "@/app/[domain]/browse/hooks/useBrowseNavigation" ;
3+ import { getBrowsePath } from "@/app/[domain]/browse/hooks/useBrowseNavigation" ;
44import { PathHeader } from "@/app/[domain]/components/pathHeader" ;
55import { LightweightCodeHighlighter } from "@/app/[domain]/components/lightweightCodeHighlighter" ;
66import { FindRelatedSymbolsResponse } from "@/features/codeNav/types" ;
77import { RepositoryInfo , SourceRange } from "@/features/search/types" ;
88import { useMemo , useRef } from "react" ;
99import useCaptureEvent from "@/hooks/useCaptureEvent" ;
1010import { useVirtualizer } from "@tanstack/react-virtual" ;
11+ import Link from "next/link" ;
12+ import { useDomain } from "@/hooks/useDomain" ;
1113
1214interface ReferenceListProps {
1315 data : FindRelatedSymbolsResponse ;
@@ -21,14 +23,14 @@ export const ReferenceList = ({
2123 data,
2224 revisionName,
2325} : ReferenceListProps ) => {
26+ const domain = useDomain ( ) ;
2427 const repoInfoMap = useMemo ( ( ) => {
2528 return data . repositoryInfo . reduce ( ( acc , repo ) => {
2629 acc [ repo . id ] = repo ;
2730 return acc ;
2831 } , { } as Record < number , RepositoryInfo > ) ;
2932 } , [ data . repositoryInfo ] ) ;
3033
31- const { navigateToPath } = useBrowseNavigation ( ) ;
3234 const captureEvent = useCaptureEvent ( ) ;
3335
3436 // Virtualization setup
@@ -38,7 +40,7 @@ export const ReferenceList = ({
3840 getScrollElement : ( ) => parentRef . current ,
3941 estimateSize : ( index ) => {
4042 const file = data . files [ index ] ;
41-
43+
4244 const estimatedSize =
4345 file . matches . length * ESTIMATED_LINE_HEIGHT_PX +
4446 ESTIMATED_MATCH_CONTAINER_HEIGHT_PX ;
@@ -103,22 +105,26 @@ export const ReferenceList = ({
103105 { file . matches
104106 . sort ( ( a , b ) => a . range . start . lineNumber - b . range . start . lineNumber )
105107 . map ( ( match , index ) => (
106- < ReferenceListItem
107- key = { index }
108- lineContent = { match . lineContent }
109- range = { match . range }
110- language = { file . language }
108+ < Link
109+ href = { getBrowsePath ( {
110+ repoName : file . repository ,
111+ revisionName,
112+ path : file . fileName ,
113+ pathType : 'blob' ,
114+ highlightRange : match . range ,
115+ domain,
116+ } ) }
111117 onClick = { ( ) => {
112118 captureEvent ( 'wa_explore_menu_reference_clicked' , { } ) ;
113- navigateToPath ( {
114- repoName : file . repository ,
115- revisionName,
116- path : file . fileName ,
117- pathType : 'blob' ,
118- highlightRange : match . range ,
119- } )
120119 } }
121- />
120+ >
121+ < ReferenceListItem
122+ key = { index }
123+ lineContent = { match . lineContent }
124+ range = { match . range }
125+ language = { file . language }
126+ />
127+ </ Link >
122128 ) ) }
123129 </ div >
124130 </ div >
@@ -134,21 +140,18 @@ interface ReferenceListItemProps {
134140 lineContent : string ;
135141 range : SourceRange ;
136142 language : string ;
137- onClick : ( ) => void ;
138143}
139144
140145const ReferenceListItem = ( {
141146 lineContent,
142147 range,
143148 language,
144- onClick,
145149} : ReferenceListItemProps ) => {
146150 const highlightRanges = useMemo ( ( ) => [ range ] , [ range ] ) ;
147151
148152 return (
149153 < div
150154 className = "w-full hover:bg-accent py-1 cursor-pointer"
151- onClick = { onClick }
152155 >
153156 < LightweightCodeHighlighter
154157 language = { language }
0 commit comments