@@ -1514,7 +1514,6 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
15141514
15151515 try {
15161516 results = await this . getSearchResults ( msg . params ) ;
1517-
15181517 void this . host . respond ( requestType , msg , results ) ;
15191518 } catch ( ex ) {
15201519 exception = ex ;
@@ -1548,24 +1547,15 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
15481547
15491548 let search : GitGraphSearch | undefined = this . _search ;
15501549
1550+ const graph = this . _graph ! ;
1551+
15511552 if ( e . more && search ?. more != null && search . comparisonKey === getSearchQueryComparisonKey ( e . search ) ) {
15521553 search = await search . more ( e . limit ?? configuration . get ( 'graph.searchItemLimit' ) ?? 100 ) ;
15531554 if ( search != null ) {
15541555 this . _search = search ;
1555- void ( await this . ensureSearchStartsInRange ( this . _graph ! , search ) ) ;
1556-
1557- return {
1558- results :
1559- search . results . size > 0
1560- ? {
1561- ids : Object . fromEntries (
1562- map ( search . results , ( [ k , v ] ) => [ this . _graph ?. remappedIds ?. get ( k ) ?? k , v ] ) ,
1563- ) ,
1564- count : search . results . size ,
1565- paging : { hasMore : search . paging ?. hasMore ?? false } ,
1566- }
1567- : undefined ,
1568- } ;
1556+ void ( await this . ensureSearchStartsInRange ( graph , search ) ) ;
1557+
1558+ return { results : this . getRemappedSearchResults ( graph , search ) } ;
15691559 }
15701560
15711561 return { results : undefined } ;
@@ -1601,7 +1591,7 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
16011591 search = this . _search ! ;
16021592 }
16031593
1604- const firstResult = await this . ensureSearchStartsInRange ( this . _graph ! , search ) ;
1594+ const firstResult = await this . ensureSearchStartsInRange ( graph , search ) ;
16051595
16061596 let sendSelectedRows = false ;
16071597 if ( firstResult != null ) {
@@ -1610,19 +1600,26 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
16101600 }
16111601
16121602 return {
1613- results : ! search . results . size
1614- ? { count : 0 }
1615- : {
1616- ids : Object . fromEntries (
1617- map ( search . results , ( [ k , v ] ) => [ this . _graph ?. remappedIds ?. get ( k ) ?? k , v ] ) ,
1618- ) ,
1619- count : search . results . size ,
1620- paging : { hasMore : search . paging ?. hasMore ?? false } ,
1621- } ,
1603+ results : ! search . results . size ? { count : 0 } : this . getRemappedSearchResults ( graph , search ) ,
16221604 selectedRows : sendSelectedRows ? this . _selectedRows : undefined ,
16231605 } ;
16241606 }
16251607
1608+ /** Remaps search results SHA for stashes to the root stash SHA */
1609+ private getRemappedSearchResults ( graph : GitGraph , search : GitGraphSearch ) {
1610+ if ( ! search . results . size ) return undefined ;
1611+
1612+ return {
1613+ ids : Object . fromEntries (
1614+ graph . remappedIds ?. size
1615+ ? map ( search . results , ( [ k , v ] ) => [ graph . remappedIds ! . get ( k ) ?? k , v ] )
1616+ : search . results ,
1617+ ) ,
1618+ count : search . results . size ,
1619+ paging : { hasMore : search . paging ?. hasMore ?? false } ,
1620+ } ;
1621+ }
1622+
16261623 private onSearchOpenInView ( e : SearchOpenInViewParams ) {
16271624 if ( this . repository == null ) return ;
16281625
@@ -1926,6 +1923,13 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
19261923 if ( this . _graph == null ) return ;
19271924
19281925 const graph = this . _graph ;
1926+ const search = this . _search ;
1927+
1928+ let searchResults : GraphSearchResults | undefined ;
1929+ if ( search ?. results . size && graph . remappedIds ?. size ) {
1930+ searchResults = this . getRemappedSearchResults ( graph , search ) ;
1931+ }
1932+
19291933 return this . host . notify (
19301934 DidChangeRowsNotification ,
19311935 {
@@ -1936,6 +1940,8 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
19361940 rowsStats : graph . rowsStats ?. size ? Object . fromEntries ( graph . rowsStats ) : undefined ,
19371941 rowsStatsLoading :
19381942 graph . rowsStatsDeferred ?. isLoaded != null ? ! graph . rowsStatsDeferred . isLoaded ( ) : false ,
1943+
1944+ searchResults : searchResults ,
19391945 selectedRows : sendSelectedRows ? this . _selectedRows : undefined ,
19401946 paging : {
19411947 startingCursor : graph . paging ?. startingCursor ,
@@ -3110,8 +3116,6 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
31103116 search ?: GitGraphSearch ,
31113117 cancellation ?: CancellationToken ,
31123118 ) {
3113- console . warn ( '##### updateGraphWithMoreRows' , id , search ) ;
3114-
31153119 const { defaultItemLimit, pageItemLimit } = configuration . get ( 'graph' ) ;
31163120 const updatedGraph = await graph . more ?.( pageItemLimit ?? defaultItemLimit , id ?? undefined , cancellation ) ;
31173121 if ( updatedGraph != null ) {
0 commit comments