Skip to content

Fix "Back to today" button not reloading active tab data#21

Merged
JoeProgrammer88 merged 2 commits intomainfrom
copilot/fix-back-to-today-button
Feb 28, 2026
Merged

Fix "Back to today" button not reloading active tab data#21
JoeProgrammer88 merged 2 commits intomainfrom
copilot/fix-back-to-today-button

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 28, 2026

Clicking "Back to today" while on any tab other than the dashboard (e.g. habits) updated the date display but left the tab content stale — it was only re-rendering the dashboard.

Root Cause

The goTodayBtn handler called this.render(), which unconditionally calls renderDashboard(). The date arrow buttons go through navigateDate(), which correctly resolves the active tab and calls switchTab().

Fix

Align goTodayBtn with the navigateDate() pattern — read the active tab and dispatch to switchTab():

// Before
this.render();

// After
const activeTabName = (document.querySelector('.nav-tab.active') as HTMLElement | null)?.dataset.tab;
if (activeTabName) {
    this.switchTab(activeTabName);
} else {
    this.renderDashboard();
}

Tests

Added an E2E test verifying that the habits tab remains active and visible after navigating to a previous day and clicking "Back to today".

Original prompt

This section details on the original issue you should resolve

<issue_title>Back to today link doesn't reload data</issue_title>
<issue_description>When going to a previous day to check off completed habits, clicking the "Back to today" button keeps all the same data unless you go back a day and then forward to the current day again using the date selection arrows</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: JoeProgrammer88 <7156063+JoeProgrammer88@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix back to today link not reloading data Fix "Back to today" button not reloading active tab data Feb 28, 2026
@JoeProgrammer88 JoeProgrammer88 marked this pull request as ready for review February 28, 2026 18:47
@JoeProgrammer88 JoeProgrammer88 merged commit 1bf2a21 into main Feb 28, 2026
1 check passed
@JoeProgrammer88 JoeProgrammer88 deleted the copilot/fix-back-to-today-button branch February 28, 2026 18:59
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.

Back to today link doesn't reload data

2 participants