diff --git a/web/src/components/filter/ReviewFilterGroup.tsx b/web/src/components/filter/ReviewFilterGroup.tsx index 4d2e1db8e..9cfe7ed5f 100644 --- a/web/src/components/filter/ReviewFilterGroup.tsx +++ b/web/src/components/filter/ReviewFilterGroup.tsx @@ -2,7 +2,7 @@ import { Button } from "../ui/button"; import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; import useSWR from "swr"; import { CameraGroupConfig, FrigateConfig } from "@/types/frigateConfig"; -import { useCallback, useEffect, useMemo, useState } from "react"; +import { useCallback, useMemo, useState } from "react"; import { DropdownMenu, DropdownMenuContent, @@ -29,6 +29,7 @@ import ReviewActivityCalendar from "../overlay/ReviewActivityCalendar"; import MobileReviewSettingsDrawer, { DrawerFeatures, } from "../overlay/MobileReviewSettingsDrawer"; +import useOptimisticState from "@/hooks/use-optimistic-state"; const REVIEW_FILTERS = [ "cameras", @@ -361,13 +362,19 @@ function ShowReviewFilter({ showReviewed, setShowReviewed, }: ShowReviewedFilterProps) { + const [showReviewedSwitch, setShowReviewedSwitch] = useOptimisticState( + showReviewed, + setShowReviewed, + ); return ( <>
setShowReviewed(showReviewed == 0 ? 1 : 0)} + checked={showReviewedSwitch == 1} + onCheckedChange={() => + setShowReviewedSwitch(showReviewedSwitch == 0 ? 1 : 0) + } />
@@ -242,7 +248,7 @@ export default function EventView({