@@ -286,8 +286,8 @@ class ReactSortableTree extends Component {
286286 } = this . state ;
287287
288288 // Get indices for rows that match the search conditions
289- const matchIndices = { } ;
290- searchMatches . forEach ( ( { treeIndex : tIndex } , i ) => { matchIndices [ tIndex ] = i ; } ) ;
289+ const matchKeys = { } ;
290+ searchMatches . forEach ( ( { path } , i ) => { matchKeys [ path [ path . length - 1 ] ] = i ; } ) ;
291291
292292 // Seek to the focused search result if there is one specified
293293 const scrollToInfo = searchFocusTreeIndex !== null ? { scrollToIndex : searchFocusTreeIndex } : { } ;
@@ -315,7 +315,7 @@ class ReactSortableTree extends Component {
315315 key ,
316316 rowStyle ,
317317 ( ) => ( rows [ index - 1 ] || null ) ,
318- matchIndices
318+ matchKeys
319319 ) }
320320 />
321321 ) }
@@ -324,11 +324,12 @@ class ReactSortableTree extends Component {
324324 ) ;
325325 }
326326
327- renderRow ( { node, path, lowerSiblingCounts, treeIndex } , listIndex , key , style , getPrevRow , matchIndices ) {
327+ renderRow ( { node, path, lowerSiblingCounts, treeIndex } , listIndex , key , style , getPrevRow , matchKeys ) {
328328 const NodeContentRenderer = this . nodeContentRenderer ;
329- const isSearchMatch = treeIndex in matchIndices ;
329+ const nodeKey = path [ path . length - 1 ] ;
330+ const isSearchMatch = nodeKey in matchKeys ;
330331 const isSearchFocus = isSearchMatch &&
331- matchIndices [ treeIndex ] === this . props . searchFocusOffset ;
332+ matchKeys [ nodeKey ] === this . props . searchFocusOffset ;
332333
333334 const nodeProps = ! this . props . generateNodeProps ? { } : this . props . generateNodeProps ( {
334335 node,
0 commit comments