Skip to content

Commit 592e3e1

Browse files
fix(web): Fix bug where the end of the search results get clipped (#749)
1 parent 9a70366 commit 592e3e1

File tree

2 files changed

+75
-70
lines changed

2 files changed

+75
-70
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Fixed "Invalid line number XXX in 21-line document" error when a invalid highlight range is passed to the file viewer. [#745](https://github.com/sourcebot-dev/sourcebot/pull/745)
1515
- Fixed visual nit where ask sb search scope selector would render long repository names poorly. [#747](https://github.com/sourcebot-dev/sourcebot/pull/747)
1616
- Fixed visual nit where long search previews in ask sb would take up a lot of space. [#747](https://github.com/sourcebot-dev/sourcebot/pull/747)
17+
- Fixed issue where the last search results was getting clipped for searches that exceed the viewport height. [#749](https://github.com/sourcebot-dev/sourcebot/pull/749)
1718

1819
## [4.10.11] - 2026-01-16
1920

packages/web/src/app/[domain]/search/components/searchResultsPage.tsx

Lines changed: 74 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -310,79 +310,83 @@ const PanelGroup = ({
310310
id={'search-results-panel'}
311311
order={2}
312312
>
313-
<div className="py-1 px-2 flex flex-row items-center">
314-
{isStreaming ? (
315-
<>
316-
<RefreshCwIcon className="h-4 w-4 animate-spin mr-2" />
317-
<p className="text-sm font-medium mr-1">Searching...</p>
318-
{numMatches > 0 && (
319-
<p className="text-sm font-medium">{`Found ${numMatches} matches in ${fileMatches.length} ${fileMatches.length > 1 ? 'files' : 'file'}`}</p>
320-
)}
321-
</>
322-
) : (
323-
<>
324-
<Tooltip>
325-
<TooltipTrigger asChild>
326-
<InfoCircledIcon className="w-4 h-4 mr-2" />
327-
</TooltipTrigger>
328-
<TooltipContent side="right" className="flex flex-col items-start gap-2 p-4">
329-
<div className="flex flex-row items-center w-full">
330-
<BugIcon className="w-4 h-4 mr-1.5" />
331-
<p className="text-md font-medium">Search stats for nerds</p>
332-
<CopyIconButton
333-
onCopy={() => {
334-
navigator.clipboard.writeText(JSON.stringify(searchStats, null, 2));
335-
return true;
336-
}}
337-
className="ml-auto"
338-
/>
313+
<div className="flex h-full flex-col">
314+
<div className="py-1 px-2 flex flex-row items-center">
315+
{isStreaming ? (
316+
<>
317+
<RefreshCwIcon className="h-4 w-4 animate-spin mr-2" />
318+
<p className="text-sm font-medium mr-1">Searching...</p>
319+
{numMatches > 0 && (
320+
<p className="text-sm font-medium">{`Found ${numMatches} matches in ${fileMatches.length} ${fileMatches.length > 1 ? 'files' : 'file'}`}</p>
321+
)}
322+
</>
323+
) : (
324+
<>
325+
<Tooltip>
326+
<TooltipTrigger asChild>
327+
<InfoCircledIcon className="w-4 h-4 mr-2" />
328+
</TooltipTrigger>
329+
<TooltipContent side="right" className="flex flex-col items-start gap-2 p-4">
330+
<div className="flex flex-row items-center w-full">
331+
<BugIcon className="w-4 h-4 mr-1.5" />
332+
<p className="text-md font-medium">Search stats for nerds</p>
333+
<CopyIconButton
334+
onCopy={() => {
335+
navigator.clipboard.writeText(JSON.stringify(searchStats, null, 2));
336+
return true;
337+
}}
338+
className="ml-auto"
339+
/>
340+
</div>
341+
<CodeSnippet renderNewlines>
342+
{JSON.stringify(searchStats, null, 2)}
343+
</CodeSnippet>
344+
</TooltipContent>
345+
</Tooltip>
346+
{
347+
fileMatches.length > 0 ? (
348+
<p className="text-sm font-medium">{`[${searchDurationMs} ms] Found ${numMatches} matches in ${fileMatches.length} ${fileMatches.length > 1 ? 'files' : 'file'}`}</p>
349+
) : (
350+
<p className="text-sm font-medium">No results</p>
351+
)
352+
}
353+
{isMoreResultsButtonVisible && (
354+
<div
355+
className="cursor-pointer text-blue-500 text-sm hover:underline ml-4"
356+
onClick={onLoadMoreResults}
357+
>
358+
(load more)
339359
</div>
340-
<CodeSnippet renderNewlines>
341-
{JSON.stringify(searchStats, null, 2)}
342-
</CodeSnippet>
343-
</TooltipContent>
344-
</Tooltip>
345-
{
346-
fileMatches.length > 0 ? (
347-
<p className="text-sm font-medium">{`[${searchDurationMs} ms] Found ${numMatches} matches in ${fileMatches.length} ${fileMatches.length > 1 ? 'files' : 'file'}`}</p>
348-
) : (
349-
<p className="text-sm font-medium">No results</p>
350-
)
351-
}
352-
{isMoreResultsButtonVisible && (
353-
<div
354-
className="cursor-pointer text-blue-500 text-sm hover:underline ml-4"
355-
onClick={onLoadMoreResults}
356-
>
357-
(load more)
358-
</div>
359-
)}
360-
</>
361-
)}
362-
</div>
363-
{filteredFileMatches.length > 0 ? (
364-
<SearchResultsPanel
365-
ref={searchResultsPanelRef}
366-
fileMatches={filteredFileMatches}
367-
onOpenFilePreview={(fileMatch, matchIndex) => {
368-
setSelectedMatchIndex(matchIndex ?? 0);
369-
setPreviewedFile(fileMatch);
370-
}}
371-
isLoadMoreButtonVisible={!!isMoreResultsButtonVisible}
372-
onLoadMoreButtonClicked={onLoadMoreResults}
373-
isBranchFilteringEnabled={isBranchFilteringEnabled}
374-
repoInfo={repoInfo}
375-
/>
376-
) : isStreaming ? (
377-
<div className="flex flex-col items-center justify-center h-full gap-2">
378-
<RefreshCwIcon className="h-6 w-6 animate-spin" />
379-
<p className="font-semibold text-center">Searching...</p>
360+
)}
361+
</>
362+
)}
380363
</div>
381-
) : (
382-
<div className="flex flex-col items-center justify-center h-full">
383-
<p className="text-sm text-muted-foreground">No results found</p>
364+
<div className="flex-1 min-h-0">
365+
{filteredFileMatches.length > 0 ? (
366+
<SearchResultsPanel
367+
ref={searchResultsPanelRef}
368+
fileMatches={filteredFileMatches}
369+
onOpenFilePreview={(fileMatch, matchIndex) => {
370+
setSelectedMatchIndex(matchIndex ?? 0);
371+
setPreviewedFile(fileMatch);
372+
}}
373+
isLoadMoreButtonVisible={!!isMoreResultsButtonVisible}
374+
onLoadMoreButtonClicked={onLoadMoreResults}
375+
isBranchFilteringEnabled={isBranchFilteringEnabled}
376+
repoInfo={repoInfo}
377+
/>
378+
) : isStreaming ? (
379+
<div className="flex flex-col items-center justify-center h-full gap-2">
380+
<RefreshCwIcon className="h-6 w-6 animate-spin" />
381+
<p className="font-semibold text-center">Searching...</p>
382+
</div>
383+
) : (
384+
<div className="flex flex-col items-center justify-center h-full">
385+
<p className="text-sm text-muted-foreground">No results found</p>
386+
</div>
387+
)}
384388
</div>
385-
)}
389+
</div>
386390
</ResizablePanel>
387391

388392
{previewedFile && (

0 commit comments

Comments
 (0)