25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(plugins): preserve sidebar shortcuts after visibility toggle
onenewcode3421febc32de
diff --git a/apps/desktop/src/components/layout/AppSidebar.vue b/apps/desktop/src/components/layout/AppSidebar.vueindex 130986751d..bef4bf2de2 100644--- a/apps/desktop/src/components/layout/AppSidebar.vue+++ b/apps/desktop/src/components/layout/AppSidebar.vue@@ -319,7 +319,7 @@ defineExpose({ focusSearch, locateTabInSidebar, disconnectAllActiveConnections,</span></template></div>- <div class="flex-1 min-h-0">+ <div data-sidebar-connection-tree class="flex-1 min-h-0"><ConnectionTree ref="connectionTreeRef" @open-settings="(initialTab) => emit('open-settings', initialTab)" @add-to-ai="(nodes) => emit('add-to-ai', nodes)" /></div><div v-if="activeConnectionEndpoint" data-sidebar-connection-endpoint class="flex shrink-0 items-center gap-1.5 border-t border-border/60 px-2.5 py-1.5 text-[11px] leading-none text-muted-foreground" :title="activeWindowConnection?.name">diff --git a/apps/desktop/src/components/plugins/PluginShortcutBar.spec.ts b/apps/desktop/src/components/plugins/PluginShortcutBar.spec.tsindex c3eaf53a34..72f3e5db99 100644--- a/apps/desktop/src/components/plugins/PluginShortcutBar.spec.ts+++ b/apps/desktop/src/components/plugins/PluginShortcutBar.spec.ts@@ -109,6 +109,19 @@ describe("plugin shortcut bar", () => {expect(document.querySelectorAll("[data-dbx-context-menu] button")).toHaveLength(3);});+ it("keeps the remaining sidebar shortcuts when one plugin visibility changes", async () => {+ mount("sidebar-bottom");+ mocks.state.editorSettings.pluginShortcuts.hiddenPluginIds = ["a"];+ mocks.entries.value = mocks.entries.value.filter((entry: any) => entry.pluginId !== "a");+ await flush();+ expect([...container.querySelectorAll("[data-shortcut-label]")].map((label) => label.textContent)).toEqual(["Function b", "Function c"]);++ mocks.state.editorSettings.pluginShortcuts.hiddenPluginIds = [];+ mocks.entries.value = [...mocks.allEntries.value];+ await flush();+ expect([...container.querySelectorAll("[data-shortcut-label]")].map((label) => label.textContent)).toEqual(["Function a", "Function b", "Function c"]);+ });+it.each(["left-top", "right-top", "sidebar-bottom"] as const)("keeps the measured preview inside both edges at %s", async (position) => {const original = HTMLElement.prototype.getBoundingClientRect;vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockImplementation(function (this: HTMLElement) {diff --git a/apps/desktop/src/composables/__tests__/usePluginShortcutHeight.spec.ts b/apps/desktop/src/composables/__tests__/usePluginShortcutHeight.spec.tsindex 144d1148f7..24ddc4c5a3 100644--- a/apps/desktop/src/composables/__tests__/usePluginShortcutHeight.spec.ts+++ b/apps/desktop/src/composables/__tests__/usePluginShortcutHeight.spec.ts@@ -24,10 +24,10 @@ async function setup() {},);root = document.createElement("div");- root.innerHTML = '<div></div><nav><div data-shortcut-resize></div><div style="padding:4px"><div style="gap:0px"><span data-shortcut-id="a"></span></div></div></nav>';+ root.innerHTML = '<div data-sidebar-connection-tree></div><div data-sidebar-connection-endpoint></div><nav><div data-shortcut-resize></div><div style="padding:4px"><div style="gap:0px"><span data-shortcut-id="a"></span></div></div></nav>';document.body.append(root);const tree = root.children[0] as HTMLElement;- const section = root.children[1] as HTMLElement;+ const section = root.children[2] as HTMLElement;const handle = section.children[0] as HTMLElement;const scroll = section.children[1] as HTMLElement;let width = 184;diff --git a/apps/desktop/src/composables/usePluginShortcutHeight.ts b/apps/desktop/src/composables/usePluginShortcutHeight.tsindex 416bcb7936..f9662ec468 100644--- a/apps/desktop/src/composables/usePluginShortcutHeight.ts+++ b/apps/desktop/src/composables/usePluginShortcutHeight.ts@@ -22,7 +22,10 @@ export function usePluginShortcutHeight(options: { section: Ref<HTMLElement | nuconst section = options.section.value;const scroll = options.scroll.value;if (!section || !scroll || !options.sidebarList.value) return;- const tree = section.previousElementSibling as HTMLElement | null;+ // The endpoint row may sit between the connection tree and this section.+ // Resolve the flexible tree wrapper explicitly so its height is not+ // mistaken for the available space when the shortcut list is refreshed.+ const tree = (section.parentElement?.querySelector<HTMLElement>("[data-sidebar-connection-tree]") ?? section.previousElementSibling) as HTMLElement | null;const divider = section.querySelector<HTMLElement>("[data-shortcut-resize]");const header = section.querySelector<HTMLElement>("[data-shortcut-header]");available.value = (tree?.offsetHeight ?? 0) + section.offsetHeight - (divider?.offsetHeight ?? 0) - (header?.offsetHeight ?? 0);