fix(connection): allow deleting broken connections

This commit is contained in:
t8y2 2026-06-15 22:54:08 +08:00
parent 8c9b1dbd15
commit d053facdd5
1 changed files with 6 additions and 3 deletions

View File

@ -1100,11 +1100,14 @@ function deleteConnection() {
async function confirmDelete() {
const targets = connectionDeleteTargets();
if (!targets.length) return;
const connectionIds = targets.map((target) => target.connectionId);
try {
for (const target of targets) {
await connectionStore.disconnect(target.connectionId);
await connectionStore.removeConnections(connectionIds);
for (const connectionId of connectionIds) {
connectionStore.disconnect(connectionId).catch((error) => {
console.warn("[DBX][connection:delete:disconnect-failed]", { connectionId, error });
});
}
await connectionStore.removeConnections(targets.map((target) => target.connectionId));
toast(targets.length > 1 ? t("connection.deletedSelected", { count: targets.length }) : t("connection.deleted"), 2000);
} catch (e: any) {
toast(t("connection.saveFailed", { message: e?.message || String(e) }), 5000);