From fbbc0de55cca4bb1f03c7aa7e8164b94051ce1e1 Mon Sep 17 00:00:00 2001 From: Marcin Mennemann Date: Mon, 18 May 2026 09:28:19 +0200 Subject: [PATCH] fix(web): added proper fallbacks for missing hash and device_id --- pkg/service/handlers/web/js/script.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/service/handlers/web/js/script.js b/pkg/service/handlers/web/js/script.js index 2b7a22b..83a2205 100644 --- a/pkg/service/handlers/web/js/script.js +++ b/pkg/service/handlers/web/js/script.js @@ -530,11 +530,13 @@ function openTab(evt, tabId) { window.addEventListener('popstate', function() { const hash = window.location.hash.slice(1); const [tabId, extra] = hash.split('?'); - if (tabId && document.getElementById(tabId)) { - openTab(null, tabId); - if (tabId === "tab-migration" && extra) { - selectMigrationDevice(extra); - } + if (!tabId || !document.getElementById(tabId)) { + openTab(null, "tab-overview"); + return; + } + openTab(null, tabId); + if (tabId === "tab-migration") { + selectMigrationDevice(extra); } }); @@ -548,6 +550,8 @@ function selectMigrationDevice(deviceId) { return; } } + sel.value = ""; + document.getElementById("migration-summary").style.display = "none"; } } @@ -1589,7 +1593,7 @@ document.addEventListener("DOMContentLoaded", async () => { const [tabId, extra] = hash.split('?'); if (tabId && document.getElementById(tabId)) { openTab(null, tabId); - if (tabId === "tab-migration" && extra) { + if (tabId === "tab-migration") { selectMigrationDevice(extra); } }