[fix](trx-frontend-http): prevent SSE from snapping freq back during optimistic update
When the user changes frequency, applyLocalTunedFrequency sets lastFreqHz optimistically. But the SSE state stream could push back the old server frequency before set_freq completes, causing the marker to snap back then forward. Add a sequence-guarded _freqOptimisticHz that suppresses stale SSE frequency updates while a set_freq is in flight. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -338,6 +338,11 @@ async function bmApply(bm) {
|
||||
}
|
||||
}
|
||||
if (typeof applyLocalTunedFrequency === "function") {
|
||||
// Set optimistic guard before applying so SSE cannot snap back.
|
||||
if (typeof _freqOptimisticSeq !== "undefined") {
|
||||
++_freqOptimisticSeq;
|
||||
_freqOptimisticHz = bm.freq_hz;
|
||||
}
|
||||
applyLocalTunedFrequency(bm.freq_hz);
|
||||
}
|
||||
if (typeof scheduleSpectrumDraw === "function" && typeof lastSpectrumData !== "undefined" && lastSpectrumData) {
|
||||
|
||||
Reference in New Issue
Block a user