Skip to content

Commit 1b36857

Browse files
committed
fix heatmap autoscrool
1 parent 15490b9 commit 1b36857

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

components/Dashboard.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,15 @@ const Heatmap = ({ dailyData, totalPrs, onDayClick }: { dailyData: DailySummary[
132132
// Auto-scroll to latest (rightmost) position
133133
useEffect(() => {
134134
if (scrollContainerRef.current) {
135-
scrollContainerRef.current.scrollLeft = scrollContainerRef.current.scrollWidth;
135+
// Use requestAnimationFrame to ensure DOM is fully rendered, especially on mobile
136+
requestAnimationFrame(() => {
137+
// Add a small delay for mobile browsers to complete layout
138+
setTimeout(() => {
139+
if (scrollContainerRef.current) {
140+
scrollContainerRef.current.scrollLeft = scrollContainerRef.current.scrollWidth;
141+
}
142+
}, 100);
143+
});
136144
}
137145
}, [heatmapData]);
138146

public/HevyAnalytics.png

1.82 MB
Loading

0 commit comments

Comments
 (0)