fix(ui): restore query tab activation

Closes #6968
This commit is contained in:
t8y2 committed 2026-08-23 03:54:17 +00:00
1 parent 4e09b007c0
commit 701f188e45
3 files changed
+24 -8

No files matched your search

@@ -11,6 +11,7 @@ describe("queryStore switchTab", () => {
setItem: vi.fn(),
removeItem: vi.fn(),
});
vi.stubGlobal("window", { dispatchEvent: vi.fn() });
setActivePinia(createPinia());
});
@@ -36,6 +37,16 @@ describe("queryStore switchTab", () => {
expect(queryStore.activeTabId).toBe(tabId);
});
it("notifies the app when switching to an existing tab", async () => {
const queryStore = useQueryStore();
const tabId = queryStore.createTab("pg-1", "app", "users", "data", "public");
const dispatchEvent = window.dispatchEvent as ReturnType<typeof vi.fn>;
queryStore.switchTab(tabId);
expect(dispatchEvent).toHaveBeenCalledWith(expect.objectContaining({ type: "dbx:activate-query-surface" }));
});
it("deactivates settings page when switching to a different tab", async () => {
const { useQueryStore } = await import("@/stores/queryStore");
const { useSettingsStore } = await import("@/stores/settingsStore");
+3
View File
@@ -84,6 +84,8 @@ import type { SqlExecutionTargetContext } from "@/lib/database/sqlExecutionTarge
import type { DriverProfileWorkspaceScope } from "@/lib/database/driverProfileExtensions";
import type { MultiDbExecutionTarget, MultiDbResultRunExecution } from "@/types/sqlExecution";
const QUERY_SURFACE_ACTIVATION_EVENT = "dbx:activate-query-surface";
const ORACLE_LIKE_METADATA_TYPES = new Set<string>(["oracle", "dameng", "oceanbase-oracle"]);
const ORACLE_DEFERRED_LOB_TYPES = new Set<string>(["CLOB", "NCLOB", "BLOB", "BFILE", "XMLTYPE", "SYS.XMLTYPE"]);
@@ -1960,6 +1962,7 @@ export const useQueryStore = defineStore("query", () => {
function switchTab(tabId: string) {
activeTabId.value = tabId;
settingsStore.settingsPageActive = false;
if (typeof window !== "undefined") window.dispatchEvent(new Event(QUERY_SURFACE_ACTIVATION_EVENT));
}
function openUserAdmin(connectionId: string) {