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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(timeline): always start at most recent frame (index 0) on load
Louis Beaumontdcfa6e62641d
diff --git a/screenpipe-app-tauri/lib/hooks/use-current-frame.tsx b/screenpipe-app-tauri/lib/hooks/use-current-frame.tsxindex 02b17762d..2677dae64 100644--- a/screenpipe-app-tauri/lib/hooks/use-current-frame.tsx+++ b/screenpipe-app-tauri/lib/hooks/use-current-frame.tsx@@ -1,5 +1,5 @@import { StreamTimeSeriesResponse } from "@/components/rewind/timeline";-import { useEffect, useRef, useState } from "react";+import { useEffect, useState } from "react";import { useTimelineStore } from "./use-timeline-store";export const useCurrentFrame = (setCurrentIndex: (index: number) => void) => {@@ -7,15 +7,14 @@ export const useCurrentFrame = (setCurrentIndex: (index: number) => void) => {useState<StreamTimeSeriesResponse | null>(null);const { frames, isLoading } = useTimelineStore();- const lastFramesLen = useRef<number>(0);+ // Select first frame (most recent) when frames load and no frame is selecteduseEffect(() => {- if (!currentFrame && frames.length) {- setCurrentFrame(frames[lastFramesLen.current]);- setCurrentIndex(lastFramesLen.current);+ if (!currentFrame && frames.length > 0) {+ setCurrentFrame(frames[0]);+ setCurrentIndex(0);}- lastFramesLen.current = frames.length;- }, [isLoading, frames]);+ }, [isLoading, frames, currentFrame, setCurrentIndex]);