fix(sidebar): align group selection with visible tree

This commit is contained in:
dadong authored and GitHub committed 2026-08-19 15:42:44 +08:00
1 parent c09dfbc813
commit a40dc02825
6 files changed
+297 -40

No files matched your search

@@ -668,6 +668,19 @@ const filteredNodes = computed(() => {
return nodes;
});
const projectedConnectionIds = computed<ReadonlySet<string> | null>(() => {
if (!isRootListPartial.value && !deferredSearchQuery.value) return null;
const connectionIds = new Set<string>();
const visit = (nodes: readonly TreeNode[]) => {
for (const node of nodes) {
if (node.type === "connection" && node.connectionId) connectionIds.add(node.connectionId);
if (node.children?.length) visit(node.children);
}
};
visit(filteredNodes.value);
return connectionIds;
});
const flatNodes = computed<FlatTreeNode[]>(() =>
insertSidebarTableSearchControls(flattenTree(filteredNodes.value), {
enabled: settingsStore.editorSettings.sidebarTableSearchEnabled && !isTreeSearchFiltering.value,
@@ -1124,6 +1137,7 @@ const pasteHandlerRegistry = createSidebarPasteHandlerRegistry();
provide(sidebarTreeContextKey, {
getVisibleNodes: () => selectableVisibleNodes.value,
getVisibleNodeIndex: (id: string) => selectableVisibleNodeIndexById.value.get(id) ?? -1,
getProjectedConnectionIds: () => projectedConnectionIds.value,
// Cover both sides of the input debounce: the immediate query prevents a
// collapse while a projection is about to start, and the deferred query
// keeps the currently rendered projection alive while clearing settles.