Skip to content

Fix duplicate 'now' declaration in served.html so dashboard buttons work#135

Merged
skyelaird merged 1 commit into
mainfrom
claude/fix-dashboard-responsive-J7fJp
May 1, 2026
Merged

Fix duplicate 'now' declaration in served.html so dashboard buttons work#135
skyelaird merged 1 commit into
mainfrom
claude/fix-dashboard-responsive-J7fJp

Conversation

@skyelaird

Copy link
Copy Markdown
Owner

Summary

The user reported the dashboard "not responsive" — the Refresh and Settings buttons did nothing — and shared a browser console with three errors:

Uncaught SyntaxError: Identifier 'now' has already been declared    (index):1672
Uncaught ReferenceError: triggerRefresh is not defined              (index):693:76
Uncaught ReferenceError: showSettings is not defined                (index):698:194

All three are caused by a single bug. Inside initializeDashboard() in served.html, const now = new Date() was declared on line 1658 and then re-declared on line 1672 in the same block scope. The same pattern repeated inside the function's setInterval callback. The resulting SyntaxError aborts parsing of the entire <script> block, so the top-level triggerRefresh (defined at line 2864) and showSettings (line 3447) never become callable, and the inline onclick handlers on lines 693 and 698 fail with ReferenceError.

This is the same bug that was fixed in src/dvoacap/dashboard/dashboard.html in commit f1c1faf (PR #134), but the captured served.html snapshot at the repo root never received the fix. This PR mirrors that fix — renaming the duplicate locals to currentHourInt and tickHour — so served.html matches dashboard.html byte-for-byte.

Test plan

  • diff src/dvoacap/dashboard/dashboard.html served.html is empty
  • Extracted inline JS from served.html parses with node --check (previously failed at line 1672)
  • triggerRefresh and showSettings are top-level function declarations, so they reach window once the script parses
  • Load the dashboard in a browser and confirm the Refresh / Settings buttons fire (also: if your installed package predates f1c1faf, run pip install -e ".[dashboard]" --force-reinstall and hard-refresh)

https://claude.ai/code/session_01BLfWHK9hf8k4aBBaQjfQa8


Generated by Claude Code

The captured served.html snapshot still had the SyntaxError that was
fixed in dashboard.html via f1c1faf: const now / const currentHour were
declared twice inside initializeDashboard() (and again inside its
setInterval callback). The parse error short-circuited the entire
script, leaving onclick handlers calling undefined triggerRefresh and
showSettings, which made the dashboard unresponsive.

Mirrors the dashboard.html fix: rename the duplicate gray-line-time
slider locals to currentHourInt and tickHour so each scope has a single
declaration. served.html now matches dashboard.html byte-for-byte.

https://claude.ai/code/session_01BLfWHK9hf8k4aBBaQjfQa8
@skyelaird skyelaird marked this pull request as ready for review May 1, 2026 18:00
@skyelaird skyelaird merged commit 6f8ac87 into main May 1, 2026
14 checks passed
@skyelaird skyelaird deleted the claude/fix-dashboard-responsive-J7fJp branch May 1, 2026 18:00
@skyelaird skyelaird mentioned this pull request May 1, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants