Skip to content

Commit b13f70e

Browse files
committed
feat: update dashboard to automatically switch to the current local day after midnight
1 parent e3b88ae commit b13f70e

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
3434

3535
### Fixed
3636

37+
- **Dashboard day rollover** — the home dashboard now switches to the current local day automatically after midnight.
3738
- **Dashboard refresh flicker** — background statistics refreshes no longer insert a loading card after the initial load, preventing the main dashboard from visibly jumping during periodic updates.
3839
- **Main app skin visibility** — fixed opaque layout backgrounds covering the configured app background image.
3940
- **Skin reset appearance** — clearing a background image now removes its overlay and restores the original theme instead of leaving a gray veil.

src/pages/Dashboard/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,18 @@ export default function Dashboard() {
134134

135135
useEffect(() => {
136136
if (periodMode !== "day" || selectedDate !== todayString()) return;
137+
const dateAtStart = selectedDate;
137138
const id = setInterval(() => {
139+
const currentDate = todayString();
140+
if (currentDate !== dateAtStart) {
141+
setSelectedDate(currentDate);
142+
return;
143+
}
138144
void fetchToday();
139145
void fetchVsCodeStatsForRange(selectedDate, selectedDate);
140146
}, 10_000);
141147
return () => clearInterval(id);
142-
}, [periodMode, selectedDate, fetchToday, fetchVsCodeStatsForRange]);
148+
}, [periodMode, selectedDate, setSelectedDate, fetchToday, fetchVsCodeStatsForRange]);
143149

144150
useEffect(() => {
145151
const end = todayString();

0 commit comments

Comments
 (0)