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
feat(grid): let a click unpin a pinned result tab
弈秋f180ad41bf81
diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vueindex cac3b7edf2..de0ac1202b 100644--- a/apps/desktop/src/components/layout/ContentArea.vue+++ b/apps/desktop/src/components/layout/ContentArea.vue@@ -1789,8 +1789,9 @@ function dispatchBeforeResultTabSwitch() {}/**- * 点击结果标签:切换显示的同时固定该结果(issue #9975)。- * 未固定的结果会被下一次普通查询复用/覆盖,点击后固定即可保留下来。+ * 点击结果标签:切换显示的同时切换固定状态(issue #9975、#13306)。+ * 未固定的结果会被下一次普通查询复用/覆盖,点击后固定即可保留下来;+ * 点击已固定的结果则直接取消固定,无需再打开右键菜单。*/async function selectResultRunFromTab(runId: string) {if (!(await selectResultRun(runId))) return;diff --git a/apps/desktop/src/components/layout/__tests__/ContentArea.resultTabClickPin.spec.ts b/apps/desktop/src/components/layout/__tests__/ContentArea.resultTabClickPin.spec.tsindex 175236c42e..dd47f38f58 100644--- a/apps/desktop/src/components/layout/__tests__/ContentArea.resultTabClickPin.spec.ts+++ b/apps/desktop/src/components/layout/__tests__/ContentArea.resultTabClickPin.spec.ts@@ -94,6 +94,15 @@ describe("result-tab click pinning", () => {expect(tab.resultRuns![0]!.pinned).toBe(true);});+ it("unpins a pinned run on click while the option is enabled (#13306)", async () => {+ const { host, tab } = await mountResults(true, true);+ expect(tab.resultRuns![1]!.pinned).toBe(true);+ host.querySelectorAll<HTMLButtonElement>("[data-result-run-tab]")[1]!.click();+ await vi.waitFor(() => expect(tab.activeResultRunId).toBe("second"));+ for (let index = 0; index < 10; index++) await nextTick();+ expect(tab.resultRuns![1]!.pinned).toBeUndefined();+ });+it("applies a setting change to already mounted result tabs", async () => {const { host, tab, settings } = await mountResults(false);settings.editorSettings.pinResultTabOnClick = true;diff --git a/apps/desktop/src/lib/__tests__/tabs/resultRunPin.spec.ts b/apps/desktop/src/lib/__tests__/tabs/resultRunPin.spec.tsindex 7d43f359f5..dda00e0ff5 100644--- a/apps/desktop/src/lib/__tests__/tabs/resultRunPin.spec.ts+++ b/apps/desktop/src/lib/__tests__/tabs/resultRunPin.spec.ts@@ -7,12 +7,13 @@ describe("shouldPinResultRunOnClick", () => {expect(shouldPinResultRunOnClick({}, true)).toBe(true);});- it("leaves an already pinned run alone", () => {- expect(shouldPinResultRunOnClick({ pinned: true }, true)).toBe(false);+ it("unpins an already pinned run on click instead of leaving it alone (#13306)", () => {+ expect(shouldPinResultRunOnClick({ pinned: true }, true)).toBe(true);});- it("does not pin when the user disabled click-to-pin", () => {+ it("does not toggle when the user disabled click-to-pin", () => {expect(shouldPinResultRunOnClick({ pinned: false }, false)).toBe(false);+ expect(shouldPinResultRunOnClick({ pinned: true }, false)).toBe(false);});it("ignores a missing run", () => {diff --git a/apps/desktop/src/lib/tabs/resultRunPin.ts b/apps/desktop/src/lib/tabs/resultRunPin.tsindex ac22f362b8..2d73ee3812 100644--- a/apps/desktop/src/lib/tabs/resultRunPin.ts+++ b/apps/desktop/src/lib/tabs/resultRunPin.ts@@ -1,8 +1,11 @@/**- * Whether clicking a result-run tab should pin that run. Pinning on click keeps- * the result from being replaced by the next query (#9975), but users who always- * want the latest result can disable it (#12381).+ * Whether clicking a result-run tab should toggle that run's pin. Pinning on+ * click keeps the result from being replaced by the next query (#9975), users+ * who always want the latest result can disable it (#12381), and clicking a+ * pinned run unpins it so removing a pin no longer needs the context menu+ * (#13306). Disabling the option keeps clicks selection-only; explicit pins+ * from the context menu still work.*/export function shouldPinResultRunOnClick(run: { pinned?: boolean } | null | undefined, pinOnClick: boolean): boolean {- return !!run && !run.pinned && pinOnClick !== false;+ return !!run && pinOnClick !== false;}