mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-30 00:19:35 +00:00
fix(query): reload connection config before execute
This commit is contained in:
@@ -128,6 +128,7 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
let layoutPersistTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
const staleTreeRefreshIds = new Set<string>();
|
||||
let beforeConnectHandler: BeforeConnectHandler | null = null;
|
||||
let initFromDiskPromise: Promise<void> | null = null;
|
||||
|
||||
function startEditing(id: string) {
|
||||
editingConnectionId.value = id;
|
||||
@@ -660,7 +661,11 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
|
||||
async function ensureConnected(connectionId: string) {
|
||||
if (connectedIds.value.has(connectionId)) return;
|
||||
const config = getConfig(connectionId);
|
||||
let config = getConfig(connectionId);
|
||||
if (!config) {
|
||||
await initFromDisk();
|
||||
config = getConfig(connectionId);
|
||||
}
|
||||
if (!config) {
|
||||
const error = new Error("Connection config not found");
|
||||
recordConnectionError(connectionId, error);
|
||||
@@ -1737,15 +1742,22 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
}
|
||||
|
||||
async function initFromDisk() {
|
||||
pinnedTreeNodeIds.value = await loadPinnedTreeNodeIds();
|
||||
const saved = await api.loadConnections();
|
||||
connections.value = saved.map(normalizeConnection);
|
||||
const savedLayout = await api.loadSidebarLayout();
|
||||
sidebarLayout.value = reconcileLayout(
|
||||
connections.value.map((c) => c.id),
|
||||
savedLayout,
|
||||
);
|
||||
rebuildTreeNodes();
|
||||
if (!initFromDiskPromise) {
|
||||
initFromDiskPromise = (async () => {
|
||||
pinnedTreeNodeIds.value = await loadPinnedTreeNodeIds();
|
||||
const saved = await api.loadConnections();
|
||||
connections.value = saved.map(normalizeConnection);
|
||||
const savedLayout = await api.loadSidebarLayout();
|
||||
sidebarLayout.value = reconcileLayout(
|
||||
connections.value.map((c) => c.id),
|
||||
savedLayout,
|
||||
);
|
||||
rebuildTreeNodes();
|
||||
})().finally(() => {
|
||||
initFromDiskPromise = null;
|
||||
});
|
||||
}
|
||||
await initFromDiskPromise;
|
||||
}
|
||||
|
||||
function addEphemeralConnection(config: ConnectionConfig) {
|
||||
|
||||
@@ -558,6 +558,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
let useAgentResultSession = false;
|
||||
try {
|
||||
const connStore = useConnectionStore();
|
||||
await connStore.ensureConnected(tab.connectionId);
|
||||
const conn = connStore.getConfig(tab.connectionId);
|
||||
const useAgentCursor = !!conn?.db_type && AGENT_DRIVER_TYPES.has(conn.db_type);
|
||||
const queryTimeoutSecs =
|
||||
|
||||
Reference in New Issue
Block a user