fix: refresh Dashboard tabs when navigating via browser back/forward

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.
This commit is contained in:
jelveh
2026-07-16 19:50:37 -07:00
parent cdf44dd69c
commit bc6122c9a4
+8
View File
@@ -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);