diff --git a/web/src/components/dynamic/NewReviewData.tsx b/web/src/components/dynamic/NewReviewData.tsx index b1b094e08..8a4752470 100644 --- a/web/src/components/dynamic/NewReviewData.tsx +++ b/web/src/components/dynamic/NewReviewData.tsx @@ -8,19 +8,22 @@ type NewReviewDataProps = { className: string; contentRef: MutableRefObject; severity: ReviewSeverity; + hasUpdate: boolean; + setHasUpdate: (update: boolean) => void; pullLatestData: () => void; }; export default function NewReviewData({ className, contentRef, severity, + hasUpdate, + setHasUpdate, pullLatestData, }: NewReviewDataProps) { const { payload: review } = useFrigateReviews(); const startCheckTs = useMemo(() => Date.now() / 1000, []); const [reviewTs, setReviewTs] = useState(startCheckTs); - const [hasUpdate, setHasUpdate] = useState(false); useEffect(() => { if (!review) { @@ -36,7 +39,7 @@ export default function NewReviewData({ if (reviewTs > startCheckTs) { setHasUpdate(true); } - }, [startCheckTs, reviewTs]); + }, [startCheckTs, reviewTs, setHasUpdate]); return (
diff --git a/web/src/views/events/EventView.tsx b/web/src/views/events/EventView.tsx index 980109203..9e2ddc8c0 100644 --- a/web/src/views/events/EventView.tsx +++ b/web/src/views/events/EventView.tsx @@ -323,6 +323,8 @@ function DetectionReview({ // review interaction + const [hasUpdate, setHasUpdate] = useState(false); + const markAllReviewed = useCallback(async () => { if (!currentItems) { return; @@ -331,6 +333,7 @@ function DetectionReview({ await axios.post(`reviews/viewed`, { ids: currentItems?.map((seg) => seg.id), }); + setHasUpdate(false); pullLatestData(); }, [currentItems, pullLatestData]); @@ -424,6 +427,8 @@ function DetectionReview({ className="absolute w-full z-30" contentRef={contentRef} severity={severity} + hasUpdate={hasUpdate} + setHasUpdate={setHasUpdate} pullLatestData={pullLatestData} /> )}