mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 11:24:43 +00:00
fix(webui): configure list-view wrapper as the scroll element for virtualization
This commit is contained in:
@@ -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={{
|
||||
|
||||
Reference in New Issue
Block a user