mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-26 17:52:59 +02:00
Fix scroll element fallback in DragDropGrid virtualization
Updated the getScrollElement function to fall back to containerRef.current if no scrolling container is found. This improves compatibility and prevents potential errors when the expected scrolling container is not present.
This commit is contained in:
parent
490c7c1018
commit
4c8ae23652
@ -77,7 +77,7 @@ const DragDropGrid = <T extends DragDropItem>({
|
||||
// Virtualization with react-virtual library
|
||||
const rowVirtualizer = useVirtualizer({
|
||||
count: Math.ceil(items.length / itemsPerRow),
|
||||
getScrollElement: () => containerRef.current?.closest('[data-scrolling-container]')!,
|
||||
getScrollElement: () => containerRef.current?.closest('[data-scrolling-container]') ?? containerRef.current,
|
||||
estimateSize: () => {
|
||||
const remToPx = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||
return parseFloat(GRID_CONSTANTS.ITEM_HEIGHT) * remToPx;
|
||||
|
Loading…
Reference in New Issue
Block a user