feat(ui): add drag and drop functionality for connection groups#126
Conversation
| setDraggingGroupId(null); | ||
| setDragOverGroupId(null); | ||
| if (!targetGroupId || targetGroupId === sourceGroupId) return; | ||
| const newOrder = [...sortedGroups]; |
There was a problem hiding this comment.
WARNING: Group reordering logic may produce unexpected results when dragging from a higher index to a lower index.
When fromIdx > toIdx, the code removes the group first (shifting indices), then inserts at the original toIdx. This inserts the moved group before the target instead of after it.
Example: Moving group at index 2 to index 0:
- After splice(2, 1): [A, B, D] (D removed)
- splice(0, 0, D): [D, A, B] - D is now at index 0, before A
User likely expects: [A, D, B] - D after A (where it was dropped).
Consider using toIdx + (fromIdx < toIdx ? 0 : 1) as the insertion index.
There was a problem hiding this comment.
The suggested fix toIdx + (fromIdx < toIdx ? 0 : 1) only differs when fromIdx > toIdx (dragging backwards), inserting at toIdx + 1 instead of toIdx. That would mean dragging D onto A places D after A rather than at A — which is the opposite of what the visual feedback (ring on A) implies.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (5 files)
Fix these issues in Kilo Cloud Reviewed by kimi-k2.5-0127 · 167,375 tokens |
|
Hey @thomaswasle , thanks for this. |
|
well done, I will merge it. thanks |
This PR adds drag and drop functionality to the Database Manager Connections.
Connections now can be dragged into a group and from one group to another. It is also possible to change the order of the groups by drag and drop.