From bc6122c9a41fa022af12d91efa6e2f9b79de58d7 Mon Sep 17 00:00:00 2001 From: jelveh Date: Thu, 16 Jul 2026 19:45:41 -0700 Subject: [PATCH] fix: refresh Dashboard tabs when navigating via browser back/forward MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sidebar-click and initial-route handlers both call the target tab's onActivate (its refresh hook), but handleRouteChange — wired to hashchange and popstate — only swapped the active classes. Since tab switches use history.pushState (which doesn't fire popstate/hashchange), the only way to reach handleRouteChange is browser back/forward, and doing so left tabs like Home/Apps showing stale data. Look up the tab by id and call onActivate after switching, matching the sidebar-click path. --- src/gui/src/UI/Dashboard/UIDashboard.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/src/UI/Dashboard/UIDashboard.js b/src/gui/src/UI/Dashboard/UIDashboard.js index 9ef50258e..39e5da5fa 100644 --- a/src/gui/src/UI/Dashboard/UIDashboard.js +++ b/src/gui/src/UI/Dashboard/UIDashboard.js @@ -396,6 +396,14 @@ async function UIDashboard (options) { document.querySelector('.dashboard-content').classList.add(tab); } + // Refresh the tab we just switched to, mirroring the sidebar-click + // handler — otherwise reaching a tab via browser back/forward leaves it + // showing stale data because its onActivate never runs. + const activeTab = tabs.find(t => t !== '-' && t.id === tab); + if ( activeTab?.onActivate ) { + activeTab.onActivate($el_window); + } + // Scroll content area to top $el_window.find('.dashboard-content').scrollTop(0);