diff --git a/static/dev_reloader.mjs b/static/dev_reloader.mjs index ee9b5c2..e9da95c 100644 --- a/static/dev_reloader.mjs +++ b/static/dev_reloader.mjs @@ -2,7 +2,7 @@ // flaky. Now we simply poll the shit out of the healthcheck endpoint. export function initDevReloader(healthzAddr, pollIntervalMs = 500) { // State model is implemented with variables and closures. - let auto = true; + let auto = !!sessionStorage.getItem("__dev_reloader_auto"); let connected = false; let initialized = false; let interval; @@ -41,6 +41,7 @@ export function initDevReloader(healthzAddr, pollIntervalMs = 500) { function toggleAuto() { auto = !auto; + sessionStorage.setItem("__dev_reloader_auto", auto ? "present" : ""); if (auto && !interval) { startInterval(); } else if (!auto && interval) { @@ -84,5 +85,7 @@ export function initDevReloader(healthzAddr, pollIntervalMs = 500) { button.appendChild(label); document.body.appendChild(button); - startInterval(); + if (auto) { + startInterval(); + } }