Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

fix(query): use selected sidebar context from toolbar

t8y27e6dc57e1713
diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue
index f60b9e7b52..28de4bf896 100644
--- a/apps/desktop/src/App.vue
+++ b/apps/desktop/src/App.vue
@@ -5111,7 +5111,7 @@ onUnmounted(() => {
:show-logout="!isDesktop && needsAuth"
@new-connection="showConnectionDialog = true"
@expand-sidebar="setSidebarOpen(true)"
- @new-query="newQuery"
+ @new-query="newQuery({ preferredSource: lastFocusedSidebarSurface ? 'sidebar' : undefined })"
@set-theme-mode="setThemeMode"
@toggle-ai="toggleRightSidebarPanel('ai')"
@toggle-history="toggleRightSidebarPanel('history')"
diff --git a/apps/desktop/src/lib/__tests__/sql/newQueryEntryContext.spec.ts b/apps/desktop/src/lib/__tests__/sql/newQueryEntryContext.spec.ts
index dfe75e478a..45b55b538c 100644
--- a/apps/desktop/src/lib/__tests__/sql/newQueryEntryContext.spec.ts
+++ b/apps/desktop/src/lib/__tests__/sql/newQueryEntryContext.spec.ts
@@ -60,6 +60,11 @@ describe("new query entry context wiring", () => {
expect(body).toContain('sidebarFocused ? "sidebar" : undefined');
});
+ it("routes the app toolbar through the last focused sidebar context (#11791)", () => {
+ const toolbar = appSource.slice(appSource.indexOf("<AppToolbar"), appSource.indexOf("/>", appSource.indexOf("<AppToolbar")));
+ expect(toolbar).toContain(`@new-query="newQuery({ preferredSource: lastFocusedSidebarSurface ? 'sidebar' : undefined })"`);
+ });
+
it("opens the database default query for Cmd+Enter from the sidebar", () => {
const body = bodyOf("async function handleKeydown");
expect(body).toContain("isExecuteSqlShortcut(e, shortcuts) && defaultQueryShortcutTarget");