Skip to content

Commit a0f3826

Browse files
committed
fix: dragging above topmost node throws error (#203)
1 parent df1ccfa commit a0f3826

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/core/src/controlledEnvironment/useOnDragOverTreeHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const getHoveringPosition = (
2323
const hoveringPosition = (clientY - treeTop) / itemHeight;
2424

2525
const treeLinearItems = linearItems[treeId];
26-
const linearIndex = Math.floor(hoveringPosition);
26+
const linearIndex = Math.max(0, Math.floor(hoveringPosition));
2727

2828
if (linearIndex > treeLinearItems.length - 1) {
2929
return {

0 commit comments

Comments
 (0)