diff --git a/src/webviews/apps/plus/graph/GraphWrapper.tsx b/src/webviews/apps/plus/graph/GraphWrapper.tsx index 1dccd86..2842ef9 100644 --- a/src/webviews/apps/plus/graph/GraphWrapper.tsx +++ b/src/webviews/apps/plus/graph/GraphWrapper.tsx @@ -330,8 +330,8 @@ export function GraphWrapper({ next = false; searchIndex = 0; } else if (direction === 'last') { - next = true; - searchIndex = count - 1; + next = false; + searchIndex = -1; } else { next = direction === 'next'; [searchIndex, id] = getClosestSearchResultIndex(results, searchQuery, activeRow, next); @@ -361,16 +361,16 @@ export function GraphWrapper({ } else { searchIndex = 0; } + } else if (direction === 'last' && searchQuery != null && results?.paging?.hasMore) { + const moreResults = await onSearchPromise?.(searchQuery, { limit: 0, more: true }); + if (moreResults?.results != null && !('error' in moreResults.results)) { + if (count < moreResults.results.count) { + results = moreResults.results; + count = results.count; + } + searchIndex = count; + } } else { - // TODO@eamodio should we load all the results here? Or just go to the end of the loaded results? - // } else if (searchQuery != null && results?.paging?.hasMore) { - // const moreResults = await onSearchCommitsPromise?.(searchQuery, { limit: 0, more: true }); - // if (moreResults?.results != null && !('error' in moreResults.results)) { - // if (count < moreResults.results.count) { - // results = moreResults.results; - // count = results.count; - // } - // } searchIndex = count - 1; } } diff --git a/src/webviews/apps/shared/components/search/search-box.ts b/src/webviews/apps/shared/components/search/search-box.ts index 59ba1b6..7367041 100644 --- a/src/webviews/apps/shared/components/search/search-box.ts +++ b/src/webviews/apps/shared/components/search/search-box.ts @@ -57,8 +57,10 @@ const template = html`