Skip to content

Commit c21d4de

Browse files
committed
fix: prevent slowdown caused by invalid targetDepth when using maxDepth
Fixes #194
1 parent 6908483 commit c21d4de

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/utils/dnd-manager.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ export default class DndManager {
104104
const draggedNode = monitor.getItem().node;
105105
const draggedChildDepth = getDepth(draggedNode);
106106

107-
targetDepth = Math.min(
108-
targetDepth,
109-
this.maxDepth - draggedChildDepth - 1
107+
targetDepth = Math.max(
108+
0,
109+
Math.min(targetDepth, this.maxDepth - draggedChildDepth - 1)
110110
);
111111
}
112112

0 commit comments

Comments
 (0)