fix(sidebar): multi-select drag, blank-click deselect, empty-group-name (#681) (#823)

Three independent connection-list bugs:

1. Multi-select drag only moved one row. The drag system tracks a single
   draggedId and ignored selectedTreeNodeIds. The drop callback now expands
   to the full selection when the grabbed row is part of it, and the store
   gains reorderSidebarEntries() to move them together.

2. Clicking the blank tree area didn't clear the selection (notably in
   double-click activation mode). Row clicks now stopPropagation and the
   tree containers clear the selection on click, so only blank clicks reset.

3. Creating a group then submitting an empty name dissolved ALL groups.
   Enter (@keydown.enter) and the following @blur both fired finishRenameGroup;
   the first call rebuilt the tree and recycled props.node onto another group,
   so the second deleted the wrong one, cascading. Guard against double
   invocation and treat an empty name as a cancel (never delete here — deleting
   a group stays in the context menu).

Verified end-to-end on the web build: multi-select drag nests both
connections under the group; blank-click clears selection; empty-name Enter
keeps all groups intact. pnpm check is green.

Co-authored-by: vrustx <vrustx@vrustxdeMac-mini.local>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-06-08 02:09:26 +08:00
1 parent c54e43e4b9
commit 14fa15531f
3 files changed
+43 -8

No files matched your search

@@ -2344,5 +2344,17 @@ export const useConnectionStore = defineStore("connection", () => {
reorderSidebarEntry(draggedId: string, targetId: string, position: DropPosition) {
updateLayoutAndRebuild(reorderEntryOp(sidebarLayout.value, draggedId, targetId, position));
},
reorderSidebarEntries(draggedIds: string[], targetId: string, position: DropPosition) {
// Apply each dragged entry in turn so a multi-selection moves together,
// not just the single grabbed row (issue #681).
let layout = sidebarLayout.value;
let changed = false;
for (const id of draggedIds) {
if (id === targetId) continue;
layout = reorderEntryOp(layout, id, targetId, position);
changed = true;
}
if (changed) updateLayoutAndRebuild(layout);
},
};
});