fix(desktop): clear connection error after successful test

This commit is contained in:
Guoyu Su authored and GitHub committed 2026-07-06 19:37:00 +08:00
1 parent 48aa5fa2e2
commit 2b5aaa2a54
1 file changed
+8 -1
@@ -1918,6 +1918,7 @@ async function testConnection() {
mongoDriverMode.value = "legacy"; mongoDriverMode.value = "legacy";
} }
testResult.value = { ok: true, message: msg }; testResult.value = { ok: true, message: msg };
clearEditedConnectionErrorAfterSuccessfulTest();
} catch (e: any) { } catch (e: any) {
if (runId !== testRunId) return; if (runId !== testRunId) return;
const message = connectionErrorWithDriverUpdateHint(config, mongodbAuthFailureHint(String(e))); const message = connectionErrorWithDriverUpdateHint(config, mongodbAuthFailureHint(String(e)));
@@ -1928,7 +1929,9 @@ async function testConnection() {
configTab.value = "advanced"; configTab.value = "advanced";
} }
testResult.value = fallbackMessage ? { ok: true, message: fallbackMessage } : { ok: false, message }; testResult.value = fallbackMessage ? { ok: true, message: fallbackMessage } : { ok: false, message };
if (!fallbackMessage) { if (fallbackMessage) {
clearEditedConnectionErrorAfterSuccessfulTest();
} else {
showConnectionError(message); showConnectionError(message);
} }
} finally { } finally {
@@ -1938,6 +1941,10 @@ async function testConnection() {
} }
} }
function clearEditedConnectionErrorAfterSuccessfulTest() {
if (editingId.value) store.clearConnectionError(editingId.value);
}
function applyConnectionUrlToForm(input: string): boolean { function applyConnectionUrlToForm(input: string): boolean {
try { try {
const draft = parseConnectionDeepLink(input); const draft = parseConnectionDeepLink(input);