fix rendering och refresh så det inte uppdatera sidan vid inställningar

This commit is contained in:
larssand
2026-08-27 14:47:24 +02:00
parent 808d5b2657
commit 32acc0e9c7
4 changed files with 59 additions and 7 deletions

View File

@@ -1423,6 +1423,12 @@ If one of these breaks, inspect this controller first.
- `tickClockHelper(...)`
- `handleSessionTimerTickHelper(...)`
Background rendering rule:
- `Timing`, `Dashboard`, and `Overlay` may rerender for live timing updates where explicitly allowed.
- decoder WebSocket `open`, `close`, and `error` events must not rerender `Settings`; they update the global connection badge instead.
- `app.js#renderViewFromBackground()` skips the one-time backend/voice refresh while a Settings control has focus or has changed.
- explicit Settings actions such as Save, Start AMMC, Stop AMMC, or Refresh may render after completing because the submitted values are already captured.
#### AMMC/backend control
- `loadAmmcConfigFromBackendHelper(...)`
- `saveAmmcConfigToBackendHelper(...)`
@@ -2261,6 +2267,23 @@ Mitigation:
- treat backend hydration and local dirty flags as runtime concerns
- inspect `src/runtime_services.js` together with the affected save path
## 17.7 Settings forms replaced by decoder reconnect
Observed failure:
- decoder IP/port fields and checkboxes reset while the operator was typing
- the operator had to enter and save values before the next refresh
Pattern:
- an unreachable or unstable WebSocket triggers `error`, `close`, reconnect after two seconds, and `open/error` again
- each lifecycle event previously called full `renderView()` while `Settings` was active
- initial backend hydration or `voiceschanged` could also replace a newly focused form
Mitigation:
- never include `settings` in decoder lifecycle rerender targets in `src/decoder_runtime.js`
- use `renderViewFromBackground()` for asynchronous app/bootstrap updates
- mark Settings as draft-active on `focusin`, `input`, and `change`
- keep a regression assertion in `tests/decoder_runtime.test.js` that `open/error/close` does not render Settings
## 18. Automated Regression Tests
Run:
@@ -2313,6 +2336,12 @@ npm test
- dirty-state protection when newer local edits occur during a request
- failed-sync behavior without false version advancement
`tests/decoder_runtime.test.js` covers:
- split and pit roles never incrementing normal laps
- pit-entry attribution surviving an endurance driver/transponder change
- one WebSocket per enabled decoder role
- decoder lifecycle events not rerendering and replacing the Settings form
`tests/audio_runtime.test.js` covers:
- explicit and language-based speech voice selection
- practice-specific versus race-specific start/finish phrases