Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

fix(sql-library): auto-close tabs when deleting saved SQL files

t8y2d9256fc1ecf5
diff --git a/apps/desktop/src/stores/savedSqlStore.ts b/apps/desktop/src/stores/savedSqlStore.ts
index e32badefd9..4120a90069 100644
--- a/apps/desktop/src/stores/savedSqlStore.ts
+++ b/apps/desktop/src/stores/savedSqlStore.ts
@@ -250,6 +250,14 @@ export const useSavedSqlStore = defineStore("savedSql", () => {
files.value = files.value.filter((file) => file.id !== id);
bumpVersion();
await syncToLocalDirectory();
+
+ // Close all tabs that reference this saved SQL file
+ const { useQueryStore } = await import("@/stores/queryStore");
+ const queryStore = useQueryStore();
+ const tabsToClose = queryStore.tabs.filter((tab) => tab.savedSqlId === id);
+ for (const tab of tabsToClose) {
+ queryStore.closeTab(tab.id, { force: true });
+ }
}
async function persistFolders(nextFolders: SavedSqlFolder[]) {