From 40be915061e3d2a84effbf7fb8d5693b045ec8e6 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 11 Jul 2024 07:09:11 -0600 Subject: [PATCH] Fix review update causing api spam (#12387) --- web/src/views/live/LiveDashboardView.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/src/views/live/LiveDashboardView.tsx b/web/src/views/live/LiveDashboardView.tsx index e14ccc4a6..06b238689 100644 --- a/web/src/views/live/LiveDashboardView.tsx +++ b/web/src/views/live/LiveDashboardView.tsx @@ -31,6 +31,7 @@ import { cn } from "@/lib/utils"; import { LivePlayerError, LivePlayerMode } from "@/types/live"; import { FaCompress, FaExpand } from "react-icons/fa"; import { useResizeObserver } from "@/hooks/resize-observer"; +import useDeepMemo from "@/hooks/use-deep-memo"; type LiveDashboardViewProps = { cameras: CameraConfig[]; @@ -63,12 +64,14 @@ export default function LiveDashboardView({ // recent events - const { payload: eventUpdate } = useFrigateReviews(); + const { payload: reviewTopic } = useFrigateReviews(); const { data: allEvents, mutate: updateEvents } = useSWR([ "review", { limit: 10, severity: "alert" }, ]); + const eventUpdate = useDeepMemo(reviewTopic); + useEffect(() => { if (!eventUpdate) { return;