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(query): isolate duplicated tab rename state
GIWTOb7e3b2ee572d
diff --git a/apps/desktop/src/components/layout/AppTabBar.vue b/apps/desktop/src/components/layout/AppTabBar.vueindex 2e7e2f0ef0..e77b6bf5e3 100644--- a/apps/desktop/src/components/layout/AppTabBar.vue+++ b/apps/desktop/src/components/layout/AppTabBar.vue@@ -129,8 +129,12 @@ function startRenameTab(tab: QueryTab) {editingTitle.value = tab.title;nextTick(() => {const input = document.querySelector<HTMLInputElement>(`[data-tab-title-input="${tab.id}"]`);- input?.focus();- input?.select();+ if (input) {+ input.focus();+ const dotIndex = input.value.lastIndexOf(".");+ const selectEnd = dotIndex > 0 ? dotIndex : input.value.length;+ input.setSelectionRange(0, selectEnd);+ }});}diff --git a/apps/desktop/src/stores/queryStore.ts b/apps/desktop/src/stores/queryStore.tsindex 80829ace31..d3bd448f7f 100644--- a/apps/desktop/src/stores/queryStore.ts+++ b/apps/desktop/src/stores/queryStore.ts@@ -1933,7 +1933,9 @@ export const useQueryStore = defineStore("query", () => {database: original.database,schema: original.schema,sql: original.sql,- savedSqlId: original.savedSqlId,+ originalSql: "",+ savedSqlId: undefined,+ externalSqlPath: undefined,lastExecutedSql: undefined,resultBaseSql: original.resultBaseSql,resultSortedSql: undefined,diff --git a/packages/app-tests/queryStore.test.ts b/packages/app-tests/queryStore.test.tsindex 2b42036ed5..35299e146a 100644--- a/packages/app-tests/queryStore.test.ts+++ b/packages/app-tests/queryStore.test.ts@@ -6119,6 +6119,25 @@ test("duplicating a table structure tab clones its unsaved draft", () => {assert.equal(tab.structureDraft.columns[0]!.name, "draft_name");});+test("duplicateTab does not inherit savedSqlId or externalSqlPath", () => {+ setActivePinia(createPinia());+ const store = useQueryStore();++ const tabId = store.createTab("conn-1", "db", "A", "query");+ const tab = store.tabs.find((t) => t.id === tabId)!;+ tab.savedSqlId = "saved-sql-1";+ tab.externalSqlPath = "/path/to/sql";+ tab.sql = "SELECT 1;";++ store.duplicateTab(tabId);++ const copy = store.tabs.find((item) => item.id !== tabId)!;+ assert.equal(copy.savedSqlId, undefined);+ assert.equal(copy.externalSqlPath, undefined);+ assert.equal(copy.originalSql, "");+ assert.equal(store.isTabDirty(copy), true);+});+test("reorderTab keeps pinned tabs before unpinned tabs after reorder", () => {setActivePinia(createPinia());const store = useQueryStore();