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
test(objects): cover search persistence after table close
zipg852ad1c808f3
diff --git a/apps/desktop/src/components/objects/__tests__/ObjectBrowserSearchPersistence.spec.ts b/apps/desktop/src/components/objects/__tests__/ObjectBrowserSearchPersistence.spec.tsindex 170fa413e7..77ff41f750 100644--- a/apps/desktop/src/components/objects/__tests__/ObjectBrowserSearchPersistence.spec.ts+++ b/apps/desktop/src/components/objects/__tests__/ObjectBrowserSearchPersistence.spec.ts@@ -1,8 +1,9 @@import { readFileSync } from "node:fs";import { describe, expect, it } from "vitest";-// Issue #8236: switching away from the "Browse Objects" tab and back reset-// the keyword search filter, because ObjectBrowser has no <KeepAlive> around+// Issues #8236 and #8285: switching away from the "Browse Objects" tab and+// back reset the keyword search, including after opening and closing a table,+// because ObjectBrowser has no <KeepAlive> around// it (ContentArea renders it inside a plain v-else-if chain) and its `search`// ref was always seeded to "". The fix threads the value through// activeTab.objectBrowser.searchQuery, mirroring the existing viewport@@ -14,6 +15,7 @@ const querySurfacesSource = readFileSync(new URL("../../layout/querySurfaces.ts"const contentSurfaceEventsSource = readFileSync(new URL("../../../lib/tabs/contentSurfaceEvents.ts", import.meta.url), "utf8");const queryStoreSource = readFileSync(new URL("../../../stores/queryStore.ts", import.meta.url), "utf8");const databaseTypesSource = readFileSync(new URL("../../../types/database.ts", import.meta.url), "utf8");+const appSource = readFileSync(new URL("../../../App.vue", import.meta.url), "utf8");describe("ObjectBrowser keyword search survives tab switches", () => {it("seeds the local search ref from a persisted initial value instead of always starting empty", () => {@@ -31,6 +33,11 @@ describe("ObjectBrowser keyword search survives tab switches", () => {expect(contentAreaSource).toContain("@search-change=\"emit('objectBrowserSearchChange', activeTab.id, $event)\"");});+ it("keeps the original object tab as the owner when a table is opened", () => {+ expect(appSource).toMatch(/@open-object-table="\s*\n?\s*\(tabId: string, target: \{[\s\S]*?\) => \{[\s\S]*?const tab = queryStore\.tabs\.find\(\(candidate\) => candidate\.id === tabId\) \?\? activeTab;[\s\S]*?openObjectBrowserTableTarget\(/);+ expect(appSource).toContain('@object-browser-search-change="(tabId: string, query: string) => queryStore.updateObjectBrowserSearch(tabId, query)"');+ });+it("the surface event contract and forwarding list both know about objectBrowserSearchChange", () => {expect(querySurfacesSource).toContain("objectBrowserSearchChange: [tabId: string, query: string];");expect(contentSurfaceEventsSource).toContain('"objectBrowserSearchChange",');