Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(ui): calendar date navigation with improved debugging

Louis Beaumont17f5a14ace4a
diff --git a/screenpipe-app-tauri/components/rewind/timeline.tsx b/screenpipe-app-tauri/components/rewind/timeline.tsx
index 1ea0d31a4..db8b4aa6b 100644
--- a/screenpipe-app-tauri/components/rewind/timeline.tsx
+++ b/screenpipe-app-tauri/components/rewind/timeline.tsx
@@ -582,8 +582,11 @@ export default function Timeline() {
// This ensures clicking on a date in the calendar always loads fresh data
clearSentRequestForDate(newDate);
+ console.log("[handleDateChange] called with:", newDate.toISOString(), "currentDate:", currentDate.toISOString());
+
try {
const checkFramesForDate = await hasFramesForDate(newDate);
+ console.log("[handleDateChange] hasFramesForDate result:", checkFramesForDate);
if (!checkFramesForDate) {
let subDate;
@@ -593,22 +596,41 @@ export default function Timeline() {
subDate = addDays(newDate, 1);
}
- // Limit recursion - don't go past start date
+ // Limit recursion - don't go past start date or future
if (isAfter(startAndEndDates.start, subDate)) {
- console.log("Reached start date boundary, stopping navigation");
+ console.log("[handleDateChange] Reached start date boundary, stopping navigation");
+ return;
+ }
+ if (isAfter(startOfDay(subDate), startOfDay(new Date()))) {
+ console.log("[handleDateChange] Reached today boundary, stopping navigation");
return;
}
+ console.log("[handleDateChange] No frames for date, trying:", subDate.toISOString());
return await handleDateChange(subDate);
}
- // Already on this day
+ // Already on this day - but still allow jumping to first frame of the day
+ // This helps when user wants to "reset" to the start of the current day
if (isSameDay(newDate, currentDate)) {
+ console.log("[handleDateChange] Same day, jumping to first frame of day");
+ // Find and jump to first frame of target date
+ const targetDayStart = startOfDay(newDate);
+ const targetDayEnd = endOfDay(newDate);
+ const targetIndex = frames.findIndex((frame) => {
+ const frameDate = new Date(frame.timestamp);
+ return frameDate >= targetDayStart && frameDate <= targetDayEnd;
+ });
+ if (targetIndex !== -1) {
+ setCurrentIndex(targetIndex);
+ setCurrentFrame(frames[targetIndex]);
+ }
return;
}
// Don't go before start date
if (isAfter(startAndEndDates.start, newDate)) {
+ console.log("[handleDateChange] Before start date, stopping");
return;
}
diff --git a/screenpipe-app-tauri/components/rewind/timeline/timeline-controls.tsx b/screenpipe-app-tauri/components/rewind/timeline/timeline-controls.tsx
index bc9b1fcd3..91550f161 100644
--- a/screenpipe-app-tauri/components/rewind/timeline/timeline-controls.tsx
+++ b/screenpipe-app-tauri/components/rewind/timeline/timeline-controls.tsx
@@ -119,6 +119,7 @@ export function TimelineControls({
mode="single"
selected={currentDate}
onSelect={(date) => {
+ console.log("[Calendar] onSelect called with:", date?.toISOString(), "currentDate:", currentDate.toISOString());
if (date) {
onDateChange(date);
setCalendarOpen(false);