fix(desktop): clear connection error after successful test

This commit is contained in:
Guoyu Su 2026-07-06 19:37:00 +08:00 committed by GitHub
parent 48aa5fa2e2
commit 2b5aaa2a54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -1918,6 +1918,7 @@ async function testConnection() {
mongoDriverMode.value = "legacy";
}
testResult.value = { ok: true, message: msg };
clearEditedConnectionErrorAfterSuccessfulTest();
} catch (e: any) {
if (runId !== testRunId) return;
const message = connectionErrorWithDriverUpdateHint(config, mongodbAuthFailureHint(String(e)));
@ -1928,7 +1929,9 @@ async function testConnection() {
configTab.value = "advanced";
}
testResult.value = fallbackMessage ? { ok: true, message: fallbackMessage } : { ok: false, message };
if (!fallbackMessage) {
if (fallbackMessage) {
clearEditedConnectionErrorAfterSuccessfulTest();
} else {
showConnectionError(message);
}
} finally {
@ -1938,6 +1941,10 @@ async function testConnection() {
}
}
function clearEditedConnectionErrorAfterSuccessfulTest() {
if (editingId.value) store.clearConnectionError(editingId.value);
}
function applyConnectionUrlToForm(input: string): boolean {
try {
const draft = parseConnectionDeepLink(input);