mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-14 15:15:22 +03:00
Fix filter buttons
This commit is contained in:
parent
54b80662cf
commit
74a1ea37f2
@ -2,7 +2,7 @@ import { Button } from "../ui/button";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
|
||||
import useSWR from "swr";
|
||||
import { FrigateConfig } from "@/types/frigateConfig";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { DropdownMenuSeparator } from "../ui/dropdown-menu";
|
||||
import { getEndOfDayTimestamp } from "@/utils/dateUtil";
|
||||
import { isMobile } from "react-device-detect";
|
||||
@ -261,6 +261,17 @@ function GeneralFilterButton({
|
||||
return `${selectedLabels.length} Labels`;
|
||||
}, [selectedLabels]);
|
||||
|
||||
// ui
|
||||
|
||||
useEffect(
|
||||
() => {
|
||||
setCurrentLabels(selectedLabels);
|
||||
},
|
||||
// only refresh when state changes
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[selectedLabels],
|
||||
);
|
||||
|
||||
const trigger = (
|
||||
<Button
|
||||
size="sm"
|
||||
@ -447,6 +458,17 @@ function ZoneFilterButton({
|
||||
return `${selectedZones.length} Zones`;
|
||||
}, [selectedZones]);
|
||||
|
||||
// ui
|
||||
|
||||
useEffect(
|
||||
() => {
|
||||
setCurrentZones(selectedZones);
|
||||
},
|
||||
// only refresh when state changes
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[selectedZones],
|
||||
);
|
||||
|
||||
const trigger = (
|
||||
<Button
|
||||
size="sm"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user