fix(settings): connect to the decoder URL shown in the field

Connect now used the saved URL even after a new one was typed; typed
decoder URLs are now saved first. Adds a browser test for saving a new
decoder port and connecting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
larssandandClaude Opus 5.5 committed 2026-10-17 17:23:48 +02:00
1 parent abed53fb32
commit cdde070c1c
7 files changed
+76 -4

No files matched your search

+10 -1
View File
@@ -701,7 +701,16 @@ Erik Eriksson;654321;4WD;Associated;;</code></pre>
renderView();
});
document.getElementById("settingsConnect")?.addEventListener("click", connectDecoder);
// Connect uses what the fields show: unsaved decoder URLs are saved first (connecting to the
// previously saved port while the field said another one was confusing).
document.getElementById("settingsConnect")?.addEventListener("click", () => {
const formNode = document.getElementById("settingsForm");
const typed = formNode ? new FormData(formNode) : null;
const changed = typed && ["wsUrl", "splitWsUrl", "pitEntryWsUrl", "pitExitWsUrl"]
.some((name) => typed.has(name) && String(typed.get(name) || "").trim() !== String(state.settings[name] || ""));
if (changed) formNode.requestSubmit();
connectDecoder();
});
document.getElementById("settingsUseCurrentOrigin")?.addEventListener("click", () => {
state.settings.backendUrl = pageOrigin;
saveState();