fix(webui): configure list-view wrapper as the scroll element for virtualization

This commit is contained in:
yiling
2026-06-10 16:26:56 +08:00
parent 6e1951e8ac
commit 7066576a8a
2 changed files with 4 additions and 5 deletions
@@ -824,7 +824,6 @@ export function FileBrowser({
handleEmptyAreaClick={handleEmptyAreaClick}
dragState={dragState}
sort={sort}
scrollContainerRef={scrollContainerRef}
/>
) : (
<FileBrowserGridView
@@ -144,7 +144,6 @@ interface FileBrowserListViewProps {
handleEmptyAreaClick: (e: React.MouseEvent) => void
dragState?: DragState
sort?: SearchSort
scrollContainerRef: React.RefObject<HTMLDivElement | null>
}
export function FileBrowserListView({
@@ -173,7 +172,6 @@ export function FileBrowserListView({
handleEmptyAreaClick,
dragState,
sort,
scrollContainerRef,
}: FileBrowserListViewProps) {
const [columnSizing, setColumnSizing] = useState<Record<string, number>>({})
@@ -253,9 +251,11 @@ export function FileBrowserListView({
return list
}, [foldersExpanded, filesExpanded, folders.length, files.length, totalFolders, totalFiles])
const localScrollRef = React.useRef<HTMLDivElement>(null)
const rowVirtualizer = useVirtualizer({
count: items.length,
getScrollElement: () => scrollContainerRef.current,
getScrollElement: () => localScrollRef.current,
estimateSize: () => 40,
overscan: 10,
})
@@ -305,7 +305,7 @@ export function FileBrowserListView({
])
return (
<div className="w-full overflow-x-auto" onClick={handleEmptyAreaClick}>
<div ref={localScrollRef} className="flex-1 overflow-auto" onClick={handleEmptyAreaClick}>
<div
className="w-full relative"
style={{