@@ -15,6 +15,7 @@ import {
1515 SortableContext ,
1616 verticalListSortingStrategy ,
1717} from "@dnd-kit/sortable" ;
18+ import { useVirtualizer } from "@tanstack/react-virtual" ;
1819import { LEFT_PANEL_ROW_HEIGHT } from "app/lib/constants" ;
1920import { usePersistence } from "app/lib/persistence/context" ;
2021import { generateKeyBetween , generateNKeysBetween } from "fractional-indexing" ;
@@ -23,7 +24,6 @@ import { useAtomValue } from "jotai";
2324import isEqual from "lodash/isEqual" ;
2425import { Portal } from "radix-ui" ;
2526import { useCallback , useEffect , useMemo , useRef , useState } from "react" ;
26- import { useVirtual } from "react-virtual" ;
2727import { USelection } from "state" ;
2828import { dataAtom , type Sel , splitsAtom } from "state/jotai" ;
2929import type { FolderMap } from "types" ;
@@ -255,9 +255,9 @@ export function FeatureEditorFolderInner() {
255255 return tree . findIndex ( ( { id } ) => id === activeId ) ;
256256 } , [ tree , activeId ] ) ;
257257
258- const rowVirtualizer = useVirtual ( {
259- size : tree . length ,
260- parentRef,
258+ const rowVirtualizer = useVirtualizer ( {
259+ count : tree . length ,
260+ getScrollElement : ( ) => parentRef . current ,
261261 estimateSize : useCallback (
262262 ( index : number ) => {
263263 return index === activeItemIndex ? 0 : LEFT_PANEL_ROW_HEIGHT ;
@@ -479,10 +479,10 @@ export function FeatureEditorFolderInner() {
479479 className = "relative w-full"
480480 style = { {
481481 willChange : "transform" ,
482- height : `${ rowVirtualizer . totalSize } px` ,
482+ height : `${ rowVirtualizer . getTotalSize ( ) } px` ,
483483 } }
484484 >
485- { rowVirtualizer . virtualItems . map ( ( row ) => {
485+ { rowVirtualizer . getVirtualItems ( ) . map ( ( row ) => {
486486 const item = tree [ row . index ] ;
487487 const isDragging = activeId === item . id ;
488488 if ( isDragging && dropIntoFolder ) {
0 commit comments