fix(sidebar): clear selection after connection moves

This commit is contained in:
William Yang authored and GitHub committed 2026-08-11 21:37:31 +08:00
1 parent 8d084cc655
commit c6f9ddb5a4
8 files changed
+576 -23

No files matched your search

@@ -385,6 +385,7 @@ const {
newSubgroup,
confirmDeleteGroup,
moveToGroup,
createGroupAndMoveConnection,
} = useSidebarConnectionMutationRuntime({
activeNode,
releaseActiveNodeReference,
@@ -3799,12 +3800,7 @@ function moveToNewGroup() {
}
function confirmMoveToNewGroup() {
const name = moveToNewGroupName.value.trim();
const node = sidebarFormTarget.value ?? activeNode.value;
if (name && node.connectionId) {
const groupId = connectionStore.createConnectionGroup(name);
connectionStore.moveConnectionToGroup(node.connectionId, groupId);
}
createGroupAndMoveConnection(moveToNewGroupName.value);
showMoveToNewGroupDialog.value = false;
}
@@ -60,6 +60,7 @@ import { hexToRgba } from "@/lib/common/color";
import { sidebarDisplayTableName } from "@/lib/sidebar/sidebarTableNameDisplay";
import { shouldMeasureSidebarLabelOverflow } from "@/lib/sidebar/sidebarLabelTooltip";
import { treeSelectionRangeIdsByIndex, treeSelectionRangeIds } from "@/lib/sidebar/sidebarTreeSelection";
import { applyConnectionMultiSelection, connectionMultiSelectionAfterToggle } from "@/lib/sidebar/sidebarConnectionMultiSelect";
import { isSidebarDatabaseOpenForVisual } from "@/lib/sidebar/sidebarDatabaseOpenState";
import { sidebarTreeContextKey } from "@/lib/sidebar/sidebarTreeContext";
import { connectionCanConfigureSidebarVisibleDatabases } from "@/lib/sidebar/sidebarVisibleFilterMenu";
@@ -568,15 +569,8 @@ function toggleConnectionMultiSelection(event: MouseEvent) {
// Keep connection-id normalization off the row render path; this handler only
// runs when the checkbox is clicked, while the checked state updates often.
const next = new Set(connectionStore.connectionMultiSelectActive ? selectedConnectionIdsForAction() : []);
if (next.has(activeNode.value.connectionId)) next.delete(activeNode.value.connectionId);
else next.add(activeNode.value.connectionId);
const ids = [...next];
connectionStore.selectedTreeNodeIds = ids;
connectionStore.selectedTreeNodeId = ids.includes(activeNode.value.connectionId) ? activeNode.value.connectionId : (ids[0] ?? null);
connectionStore.treeSelectionAnchorId = activeNode.value.connectionId;
connectionStore.connectionMultiSelectActive = ids.length > 0;
const current = { connectionIds: selectedConnectionIdsForAction(), active: connectionStore.connectionMultiSelectActive };
applyConnectionMultiSelection(connectionStore, connectionMultiSelectionAfterToggle(current, activeNode.value.connectionId));
rowRef.value?.focus({ preventScroll: true });
}