fix(sql-library): auto-close tabs when deleting saved SQL files
Closes #1566 When a saved SQL file is deleted from the SQL library panel, any open tabs referencing that file are now automatically closed to maintain consistency between the library and open tabs. Changes: - Modified savedSqlStore.deleteFile() to find and close all tabs with matching savedSqlId - Tabs are force-closed to avoid unsaved changes prompts for deleted files
This commit is contained in:
1 parent
791d55661e
commit
d9256fc1ec
1 file changed
+8
@@ -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[]) {
|
||||
|
||||
Reference in new issue
Block a user