This commit is contained in:
2026-09-18 17:45:27 +03:00
parent 52cd9a15e3
commit b2937fae17
3 changed files with 24 additions and 6 deletions

View File

@@ -996,6 +996,9 @@
}
async function refreshDrawerCache() {
// Do not patch/re-render Runtime data while the operator edits settings.
// The hourly server refresh keeps running; the browser catches up afterwards.
if (operatorSettingsEditingActive()) return;
if ((!state.open && !state.selectedId) || state.drawerRefreshBusy) return;
state.drawerRefreshBusy = true;
try {
@@ -1995,6 +1998,17 @@ function selectedGameIsFinished() {
return Boolean(state.selectedGame?.is_finished);
}
function operatorSettingsEditingActive() {
// BUILD144: settings are operator-owned UI state. Live match/schedule refresh
// may continue on the server, but must not rebuild the Runtime while an
// operator is typing into either Stat2TV settings or a full UI settings modal.
return Boolean(
state.settingsModal
|| document.querySelector(".hockey-settings-modal")
|| document.querySelector(".modal-settings-full")
);
}
function scheduleSelectedGamePoll(delay = 1000) {
stopSelectedGamePolling();
if (!state.selectedGameId || selectedGameIsFinished()) {
@@ -2022,6 +2036,7 @@ async function pollSelectedGame() {
|| !state.selectedGameId
|| !state.selectedId
|| state.open
|| operatorSettingsEditingActive()
|| selectedGameIsFinished()
) {
scheduleSelectedGamePoll(1000);
@@ -2498,6 +2513,10 @@ document.addEventListener("visibilitychange", () => {
const close = () => {
modal.remove();
state.settingsModal = null;
if (state.selectedGameId && !selectedGameIsFinished()) {
scheduleSelectedGamePoll(150);
}
if (state.selectedId) scheduleDrawerRefresh(250);
};
modal.querySelector("[data-settings-close]").addEventListener("click", close);
modal.querySelector(".hockey-settings-backdrop").addEventListener("click", close);