feat(connection): preserve failed one-time connections

This commit is contained in:
zipg
2026-08-25 14:02:51 +08:00
committed by GitHub
parent d1d8dc4aec
commit b488942d82
2 changed files with 11 additions and 1 deletions
@@ -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;
@@ -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"');
});
});