From 2fb1ed729fbd61d70b38a11903fb35eabb2bdca1 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Tue, 13 Jan 2026 13:33:43 -1000 Subject: Fix tab state persistence with URL query parameters (Bug 002) - Extract tab query param in HandleDashboard, default to "tasks" - Wrap DashboardData with ActiveTab field for template access - Update index.html with conditional tab-button-active class - Add hx-push-url="?tab=..." to each tab button for URL persistence - Update content div to load active tab from server state - Update app.js to read currentTab from URL query parameters - Add comprehensive tab_state_test.go test suite - Tab selection now persists through page reloads - All tests passing Co-Authored-By: Claude Sonnet 4.5 --- web/static/js/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'web/static') diff --git a/web/static/js/app.js b/web/static/js/app.js index a930b1f..2f2cb6f 100644 --- a/web/static/js/app.js +++ b/web/static/js/app.js @@ -3,8 +3,9 @@ // Constants const AUTO_REFRESH_INTERVAL = 5 * 60 * 1000; // 5 minutes in milliseconds -// Track current active tab -let currentTab = 'tasks'; +// Track current active tab (read from URL for state persistence) +const urlParams = new URLSearchParams(window.location.search); +let currentTab = urlParams.get('tab') || 'tasks'; let autoRefreshTimer = null; // Initialize on page load -- cgit v1.2.3