From b488942d82c5c522e3f2caa6fcfb9090b819085f Mon Sep 17 00:00:00 2001 From: zipg Date: Tue, 25 Aug 2026 14:02:51 +0800 Subject: [PATCH] feat(connection): preserve failed one-time connections --- .../src/components/connection/ConnectionDialog.vue | 3 ++- .../connection/connectionDialog.deepLinkServices.spec.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue index a0eda63d6f..37489c2514 100644 --- a/apps/desktop/src/components/connection/ConnectionDialog.vue +++ b/apps/desktop/src/components/connection/ConnectionDialog.vue @@ -5190,7 +5190,8 @@ async function save() { .catch((e: any) => { const message = String(e?.message || e); if (message.includes(CONNECTION_ATTEMPT_CANCELLED_MESSAGE)) return; - if (config.one_time) void store.removeConnection(config.id); + // Keep failed one-time connections available for retry and error inspection. + // They are still removed by connectionStore.disconnect after a successful session. emit("connectFailed", appendConnectionErrorHints(config, mongodbAuthFailureHint(message), t)); }); return; diff --git a/apps/desktop/src/lib/__tests__/connection/connectionDialog.deepLinkServices.spec.ts b/apps/desktop/src/lib/__tests__/connection/connectionDialog.deepLinkServices.spec.ts index dc67c37806..6646a3b188 100644 --- a/apps/desktop/src/lib/__tests__/connection/connectionDialog.deepLinkServices.spec.ts +++ b/apps/desktop/src/lib/__tests__/connection/connectionDialog.deepLinkServices.spec.ts @@ -31,4 +31,13 @@ describe("ConnectionDialog service deep-link hydration", () => { expect(applyBody).toContain("parseConnectionDeepLink(input) ?? parseServiceConnectionUrl(input)"); expect(applyBody.indexOf("applyConnectionDraftToForm")).toBeLessThan(applyBody.indexOf("parseConnectionUrl(input")); }); + + it("keeps failed one-time connections available for error inspection and retry", () => { + const saveStart = source.indexOf("async function save()"); + const saveEnd = source.indexOf('const dialogTitle = ref("")', saveStart); + const saveBody = source.slice(saveStart, saveEnd); + + expect(saveBody).not.toContain("store.removeConnection(config.id)"); + expect(saveBody).toContain('emit("connectFailed"'); + }); });