From 75c805a7a06e6edf1daedf723c8367c45e748925 Mon Sep 17 00:00:00 2001 From: ruixingshi <2946193417@qq.com> Date: Sat, 17 Aug 2024 22:51:11 +0800 Subject: [PATCH] fix: fix index error when multiple selections were dragged to the original position --- stories/src/multi-drag/utils.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stories/src/multi-drag/utils.js b/stories/src/multi-drag/utils.js index 007afdcba7..3de788acf6 100644 --- a/stories/src/multi-drag/utils.js +++ b/stories/src/multi-drag/utils.js @@ -121,7 +121,13 @@ const reorderMultiDrag = ({ const index: number = column.taskIds.indexOf(current); - if (index >= destination.index) { + // When dragging up, do not increment the indexOffset while source.index equal to destination.index. + // When dragging down, increment the indexOffset while source.index equal to destination.index + if ( + source.index >= destination.index + ? index >= destination.index + : index > destination.index + ) { return previous; }