fix(connection): per-id saves stop cross-client connection clobber

This commit is contained in:
zipg authored and GitHub committed 2026-09-26 21:45:03 +08:00
1 parent a8006a1fdd
commit 33cac93254
9 files changed
+188 -35

No files matched your search

+6 -1
View File
@@ -570,7 +570,12 @@ export async function closeDatabaseConnection(connectionId: string, database: st
return post("/api/connection/close-database", { connectionId, database });
}
export async function saveConnections(configs: ConnectionConfig[]): Promise<void> {
export async function saveConnections(configs: ConnectionConfig[], removedIds: string[] = []): Promise<void> {
// Saving upserts; ids this client deleted are sent explicitly so that a
// stale local list can never drop connections another client created.
if (removedIds.length) {
return post("/api/connection/save", { configs, removedIds });
}
return post("/api/connection/save", { configs });
}
+2 -2
View File
@@ -2511,8 +2511,8 @@ export async function exportDocsHtml(filePath: string, snapshot: SchemaSnapshot,
return invoke("docs_export_html", { filePath, snapshot, annotations, lang });
}
export async function saveConnections(configs: ConnectionConfig[]): Promise<void> {
return invoke("save_connections", { configs });
export async function saveConnections(configs: ConnectionConfig[], removedIds: string[] = []): Promise<void> {
return invoke("save_connections", { configs, removedIds });
}
export async function loadConnections(): Promise<ConnectionConfig[]> {