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: search highlight disappears + text selection intermittently fails

Louis Beaumont58a1b8c02b58
diff --git a/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx
index 64ef1ba17..330b56905 100644
--- a/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx
@@ -959,8 +959,10 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({
)}
{/* Selectable text layer — rendered as its own layer, NOT inside TextOverlay's
- pointer-events:none wrapper. This ensures WebKit allows text selection. */}
- {!isLoading && !hasError && !ocrLoading && renderedImageInfo && textPositions.length > 0 && (
+ pointer-events:none wrapper. This ensures WebKit allows text selection.
+ NOTE: intentionally omit !ocrLoading — keep the layer mounted with previous
+ positions while new OCR data loads, so text selection isn't interrupted. */}
+ {!isLoading && !hasError && renderedImageInfo && textPositions.length > 0 && (
<div className="absolute" style={{ zIndex: 4, top: 0, left: 0, right: 0, bottom: 0, pointerEvents: "none" }}>
<div style={{
position: "absolute",
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
index e6f625c1a..a0ba13d48 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
@@ -180,10 +180,29 @@ export default function Timeline({ embedded = false }: { embedded?: boolean }) {
const dismissSearchHighlight = useSearchHighlight((s) => s.dismiss);
const hasSearchHighlight = useSearchHighlight((s) => s.highlightTerms.length > 0 && !s.dismissed);
- // Dismiss search highlights when user scrolls/navigates away (not from the initial search jump)
+ // Dismiss search highlights when user scrolls/navigates away (not from the initial search jump).
+ // Grace period after searchNavFrame clears: the image-load callback sets searchNavFrame=false
+ // in the same tick that may also bump currentIndex (snap/debounce), so we wait a short window
+ // before allowing dismiss — otherwise the highlight vanishes instantly after navigation.
const prevIndexRef = useRef(currentIndex);
+ const searchNavJustClearedRef = useRef(false);
+ const searchNavGraceRef = useRef<ReturnType<typeof setTimeout> | null>(null);
+
+ useEffect(() => {
+ if (!searchNavFrame) {
+ // searchNavFrame just turned off — start grace period
+ searchNavJustClearedRef.current = true;
+ searchNavGraceRef.current = setTimeout(() => {
+ searchNavJustClearedRef.current = false;
+ }, 500);
+ }
+ return () => {
+ if (searchNavGraceRef.current) clearTimeout(searchNavGraceRef.current);
+ };
+ }, [searchNavFrame]);
+
useEffect(() => {
- if (prevIndexRef.current !== currentIndex && !searchNavFrame && hasSearchHighlight) {
+ if (prevIndexRef.current !== currentIndex && !searchNavFrame && !searchNavJustClearedRef.current && hasSearchHighlight) {
dismissSearchHighlight();
}
prevIndexRef.current = currentIndex;