File tree Expand file tree Collapse file tree 1 file changed +9
-16
lines changed
Expand file tree Collapse file tree 1 file changed +9
-16
lines changed Original file line number Diff line number Diff line change 1- import { memo , useCallback } from 'react'
1+ import { memo } from 'react'
22import type { DisplayResult } from '../../../types'
33import TreeItem from './TreeItem'
44import { refScroller } from './useListState'
@@ -22,26 +22,19 @@ interface SearchResultListProps {
2222 matches : Array < [ string , DisplayResult [ ] ] >
2323}
2424
25+ function itemContent ( _ : number , data : [ string , DisplayResult [ ] ] ) {
26+ return < TreeItem className = { 'sg-match-tree-item' } matches = { data [ 1 ] } />
27+ }
28+ function computeItemKey ( _ : number , data : [ string , DisplayResult [ ] ] ) {
29+ return data [ 0 ]
30+ }
2531const SearchResultList = ( { matches } : SearchResultListProps ) => {
26- const render = useCallback (
27- ( index : number ) => {
28- const match = matches [ index ] [ 1 ]
29- return < TreeItem className = { 'sg-match-tree-item' } matches = { match } />
30- } ,
31- [ matches ] ,
32- )
33- const computeItemKey = useCallback (
34- ( index : number ) => {
35- return matches [ index ] [ 0 ]
36- } ,
37- [ matches ] ,
38- )
3932 return (
4033 < Virtuoso
4134 ref = { refScroller }
4235 { ...stylex . props ( styles . resultList ) }
43- totalCount = { matches . length }
44- itemContent = { render }
36+ data = { matches }
37+ itemContent = { itemContent }
4538 computeItemKey = { computeItemKey }
4639 />
4740 )
You can’t perform that action at this time.
0 commit comments