From 45f56b8c5d064d7e2181e5b81227e0b91f7985d8 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 14 Nov 2025 03:38:33 +0000 Subject: [PATCH 1/3] fix: persist onloadBehavior setting for default map feature The default map feature was not working on page refresh because the onloadBehavior dropdown value was not being persisted or restored. Changes: - main.js: Restore onloadBehavior from localStorage on page load - save.js: saveAsDefaultMap() now saves "default" to localStorage - save.js: clearDefaultMap() now removes the localStorage setting - index.html: Update version hashes to 1.108.13 Now when users click "Set as default", the setting persists across page refreshes and their default map loads automatically. --- index.html | 4 ++-- main.js | 6 ++++++ modules/io/save.js | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index d73b3ff7..976ee481 100644 --- a/index.html +++ b/index.html @@ -8232,7 +8232,7 @@ - @@ -8277,7 +8277,7 @@ - + diff --git a/main.js b/main.js index 4f4bdb63..1f91ed4a 100644 --- a/main.js +++ b/main.js @@ -291,6 +291,12 @@ async function checkLoadParameters() { return; } + // restore onloadBehavior from localStorage if saved + const storedBehavior = localStorage.getItem("onloadBehavior"); + if (storedBehavior) { + byId("onloadBehavior").value = storedBehavior; + } + // check if there is a default map saved to indexedDB if (byId("onloadBehavior").value === "default") { try { diff --git a/modules/io/save.js b/modules/io/save.js index 7a9236c7..c4db90a2 100644 --- a/modules/io/save.js +++ b/modules/io/save.js @@ -175,6 +175,8 @@ async function saveAsDefaultMap() { const mapData = prepareMapData(); const blob = new Blob([mapData], {type: "text/plain"}); await ldb.set("defaultMap", blob); + localStorage.setItem("onloadBehavior", "default"); + byId("onloadBehavior").value = "default"; tip("Map is set as default and will open on load", true, "success", 5000); } catch (error) { ERROR && console.error(error); @@ -186,6 +188,8 @@ async function saveAsDefaultMap() { async function clearDefaultMap() { try { await ldb.set("defaultMap", null); + localStorage.removeItem("onloadBehavior"); + byId("onloadBehavior").value = "random"; tip("Default map cleared", false, "success", 2000); } catch (error) { ERROR && console.error(error); From 390e70f63a780e0c87eff81ec1272939cf4cbbb2 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 14 Nov 2025 03:43:51 +0000 Subject: [PATCH 2/3] debug: add logging to troubleshoot default map issue --- main.js | 2 ++ modules/io/save.js | 1 + 2 files changed, 3 insertions(+) diff --git a/main.js b/main.js index 1f91ed4a..5d67e029 100644 --- a/main.js +++ b/main.js @@ -293,9 +293,11 @@ async function checkLoadParameters() { // restore onloadBehavior from localStorage if saved const storedBehavior = localStorage.getItem("onloadBehavior"); + WARN && console.warn("Stored onloadBehavior:", storedBehavior); if (storedBehavior) { byId("onloadBehavior").value = storedBehavior; } + WARN && console.warn("Current onloadBehavior value:", byId("onloadBehavior").value); // check if there is a default map saved to indexedDB if (byId("onloadBehavior").value === "default") { diff --git a/modules/io/save.js b/modules/io/save.js index c4db90a2..5232bcf7 100644 --- a/modules/io/save.js +++ b/modules/io/save.js @@ -177,6 +177,7 @@ async function saveAsDefaultMap() { await ldb.set("defaultMap", blob); localStorage.setItem("onloadBehavior", "default"); byId("onloadBehavior").value = "default"; + WARN && console.warn("Default map saved. onloadBehavior set to:", localStorage.getItem("onloadBehavior")); tip("Map is set as default and will open on load", true, "success", 5000); } catch (error) { ERROR && console.error(error); From e8767ce01ab27a1c61aeb789c08c3e33fd2ee6e9 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 14 Nov 2025 03:44:27 +0000 Subject: [PATCH 3/3] debug: update version hashes for cache busting --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 976ee481..f69c971c 100644 --- a/index.html +++ b/index.html @@ -8232,7 +8232,7 @@ - @@ -8277,7 +8277,7 @@ - +