mirror of
https://github.com/t8y2/dbx.git
synced 2026-11-01 16:28:46 +00:00
fix(schema): auto-select schema when creating query from schema context menu
When right-clicking a PostgreSQL schema node and selecting "New Query", the schema dropdown in the editor toolbar was not pre-selected. Pass node.schema to createTab so the editor initializes with the correct schema.
This commit is contained in:
@@ -561,7 +561,7 @@ async function newQuery() {
|
||||
await connectionStore.ensureConnected(node.connectionId);
|
||||
connectionStore.activeConnectionId = node.connectionId;
|
||||
if (node.database) {
|
||||
queryStore.createTab(node.connectionId, node.database, undefined, "query");
|
||||
queryStore.createTab(node.connectionId, node.database, undefined, "query", node.schema);
|
||||
return;
|
||||
}
|
||||
const connection = connectionStore.getConfig(node.connectionId);
|
||||
|
||||
@@ -111,7 +111,13 @@ export const useQueryStore = defineStore("query", () => {
|
||||
return tabs.value.find((t) => t.connectionId === connectionId && t.database === database && t.title === title);
|
||||
}
|
||||
|
||||
function createTab(connectionId: string, database: string, title?: string, mode: QueryTab["mode"] = "query") {
|
||||
function createTab(
|
||||
connectionId: string,
|
||||
database: string,
|
||||
title?: string,
|
||||
mode: QueryTab["mode"] = "query",
|
||||
schema?: string,
|
||||
) {
|
||||
if (title) {
|
||||
const existing = findTabByTitle(connectionId, database, title);
|
||||
if (existing) {
|
||||
@@ -126,6 +132,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
title: title || `Query ${tabs.value.length + 1}`,
|
||||
connectionId,
|
||||
database,
|
||||
schema,
|
||||
sql: "",
|
||||
isExecuting: false,
|
||||
isCancelling: false,
|
||||
|
||||
Reference in New Issue
Block a user