diff --git a/apps/desktop/src/components/sidebar/ConnectionTree.vue b/apps/desktop/src/components/sidebar/ConnectionTree.vue index d98a91a268..7dfa0622e3 100644 --- a/apps/desktop/src/components/sidebar/ConnectionTree.vue +++ b/apps/desktop/src/components/sidebar/ConnectionTree.vue @@ -785,15 +785,14 @@ function readExpandedSidebarSchemas(): Array<{ id: string; label: string }> { return expanded; } -// The plain (non-virtualized) renderer keeps the sticky database/schema header -// via native CSS position: sticky on the container rows, mirroring the overlay -// the virtual branch renders. Only container rows stick; children scroll under -// them until the next container takes over. -function isPlainStickyContainerNode(node: TreeNode): boolean { +// The plain (non-virtualized) renderer uses the same container selection as the +// virtual sticky overlay: database containers take precedence, while schema +// containers stick only in trees without a database-level container. +function isPlainStickyContainerNode(index: number): boolean { // Mirror the virtual branch's sticky overlay: both suppress sticky headers // while a search filter is active so filtered rows don't pin at the top. if (isTreeSearchFiltering.value) return false; - return DATABASE_LEVEL_TYPES.has(node.type) || SCHEMA_LEVEL_TYPES.has(node.type); + return flatTreeIndex.value.stickyContainerIndexByIndex[index] === index; } const sidebarLayoutMonitor = createSidebarLayoutMonitor({ @@ -2506,7 +2505,7 @@ defineExpose({ focusSearch, createNewGroup, collapseAllTreeNodes, locateTabInSid /> -