Fix review update causing api spam (#12387)

This commit is contained in:
Nicolas Mowen 2024-07-11 07:09:11 -06:00 committed by GitHub
parent 0d7ee7a87a
commit 40be915061
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,6 +31,7 @@ import { cn } from "@/lib/utils";
import { LivePlayerError, LivePlayerMode } from "@/types/live"; import { LivePlayerError, LivePlayerMode } from "@/types/live";
import { FaCompress, FaExpand } from "react-icons/fa"; import { FaCompress, FaExpand } from "react-icons/fa";
import { useResizeObserver } from "@/hooks/resize-observer"; import { useResizeObserver } from "@/hooks/resize-observer";
import useDeepMemo from "@/hooks/use-deep-memo";
type LiveDashboardViewProps = { type LiveDashboardViewProps = {
cameras: CameraConfig[]; cameras: CameraConfig[];
@ -63,12 +64,14 @@ export default function LiveDashboardView({
// recent events // recent events
const { payload: eventUpdate } = useFrigateReviews(); const { payload: reviewTopic } = useFrigateReviews();
const { data: allEvents, mutate: updateEvents } = useSWR<ReviewSegment[]>([ const { data: allEvents, mutate: updateEvents } = useSWR<ReviewSegment[]>([
"review", "review",
{ limit: 10, severity: "alert" }, { limit: 10, severity: "alert" },
]); ]);
const eventUpdate = useDeepMemo(reviewTopic);
useEffect(() => { useEffect(() => {
if (!eventUpdate) { if (!eventUpdate) {
return; return;