morse: guard in-flight status polls from overriding stop state

The previous stopPromise guard only prevented new polls from being
dispatched. Polls already in-flight before stop was clicked could still
return with running=true and override the stopping lifecycle, causing
SSE reconnection and an apparent restart loop. Add a second guard in
the .then() handler to check stopPromise/lifecycle before acting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-02-26 22:04:32 +00:00
parent c0fb22124b
commit dc0775f7df

View File

@@ -421,6 +421,8 @@ var MorseMode = (function () {
.then(function (r) { return parseJsonSafe(r); })
.then(function (data) {
if (!data || typeof data !== 'object') return;
// Guard against in-flight polls that were dispatched before stop
if (state.stopPromise || state.lifecycle === 'stopping') return;
if (data.running) {
if (data.state === 'starting') {