From 0fbd63287597a0567149d91657367ec9012152b3 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 1 Jun 2026 11:58:06 -0500 Subject: [PATCH] fix multi-day seeking --- web/src/views/motion-search/MotionSearchView.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/src/views/motion-search/MotionSearchView.tsx b/web/src/views/motion-search/MotionSearchView.tsx index 125ceed7b1..117a70975c 100644 --- a/web/src/views/motion-search/MotionSearchView.tsx +++ b/web/src/views/motion-search/MotionSearchView.tsx @@ -182,6 +182,7 @@ export default function MotionSearchView({ undefined, ); const [pendingSeekTime, setPendingSeekTime] = useState(null); + const pendingSeekTimeRef = useRef(null); // Formatted search window shown above the results (same date+time convention). const formattedSearchRange = useFormattedRange( @@ -642,7 +643,7 @@ export default function MotionSearchView({ ]); useEffect(() => { - if (pendingSeekTime != null) { + if (pendingSeekTimeRef.current != null) { return; } @@ -656,7 +657,7 @@ export default function MotionSearchView({ setPlaybackStart(nextTime); setSelectedRangeIdx(index === -1 ? chunkedTimeRange.length - 1 : index); mainControllerRef.current?.seekToTimestamp(nextTime, true); - }, [pendingSeekTime, timeRange, chunkedTimeRange]); + }, [timeRange, chunkedTimeRange]); useEffect(() => { if (!scrubbing) { @@ -951,6 +952,7 @@ export default function MotionSearchView({ result.timestamp < timeRange.after || result.timestamp > timeRange.before ) { + pendingSeekTimeRef.current = result.timestamp; setPendingSeekTime(result.timestamp); onDaySelect(new Date(result.timestamp * 1000)); return; @@ -972,6 +974,7 @@ export default function MotionSearchView({ ) { manuallySetCurrentTime(pendingSeekTime, true); setPendingSeekTime(null); + pendingSeekTimeRef.current = null; } }, [pendingSeekTime, timeRange, manuallySetCurrentTime]);