fix(overlay): overlay windows are read-only, no decoder connection or saves (1.76.1)
This commit is contained in:
1 parent
3d0ab0c4b7
commit
54989d8597
7 files changed
+21
-8
No files matched your search
+7
-5
@@ -5797,7 +5797,8 @@ async function init() {
|
||||
updateHeaderState();
|
||||
updateConnectionBadge();
|
||||
// The decoder simulator (Settings) is connected on load even with auto-reconnect off.
|
||||
if (state.settings.wsUrl && (state.settings.autoReconnect || state.settings.simPreviousWsUrl) && !state.decoder.connected) {
|
||||
// An overlay window only shows: the race controller's browser owns the decoder.
|
||||
if (!overlayMode && state.settings.wsUrl && (state.settings.autoReconnect || state.settings.simPreviousWsUrl) && !state.decoder.connected) {
|
||||
connectDecoder();
|
||||
}
|
||||
});
|
||||
@@ -5812,9 +5813,6 @@ async function init() {
|
||||
startOverlayRotation();
|
||||
startOverlayLiveRefresh();
|
||||
|
||||
if (overlayMode && state.settings.wsUrl && !state.decoder.connected) {
|
||||
connectDecoder();
|
||||
}
|
||||
}
|
||||
|
||||
function updateSyncStatus() {
|
||||
@@ -6113,6 +6111,9 @@ function loadState() {
|
||||
}
|
||||
|
||||
function saveState(options = {}) {
|
||||
// Overlay windows (also on another computer) are read-only: they follow the server every
|
||||
// 0.8 s and never push their copy, which could undo a start or laps from Race Day.
|
||||
if (overlayMode) return;
|
||||
const persistable = buildPersistableState();
|
||||
const cached = writeLocalCache(localStorage, STORAGE_KEY, persistable);
|
||||
if (!cached.ok && !localCacheFull) console.warn("Browser storage is full; the local cache is dropped and the server's state is used.", cached.error);
|
||||
@@ -8084,7 +8085,7 @@ function findDuplicateSessionTransponders(session) {
|
||||
}
|
||||
|
||||
async function persistSessionResultToBackend(sessionId) {
|
||||
if (!sessionId || !state.resultsBySession[sessionId]) return;
|
||||
if (overlayMode || !sessionId || !state.resultsBySession[sessionId]) return;
|
||||
try {
|
||||
const res = await fetch(`${getBackendUrl()}/api/session-results`, {
|
||||
method: "POST",
|
||||
@@ -8098,6 +8099,7 @@ async function persistSessionResultToBackend(sessionId) {
|
||||
}
|
||||
|
||||
async function persistPassingToBackend(sessionId, passing) {
|
||||
if (overlayMode) return;
|
||||
backend.pendingWrites = (backend.pendingWrites || 0) + 1;
|
||||
try {
|
||||
const res = await fetch(`${getBackendUrl()}/api/passings`, {
|
||||
|
||||
Reference in new issue
Block a user