Skip to content

Commit

Permalink
Fixes (#15465)
Browse files Browse the repository at this point in the history
* Fix single event return

* Allow customizing if search is preserved for overlay state

* Remove timeout

* Cleanup

* Cleanup naming
  • Loading branch information
NickM-27 authored Dec 12, 2024
1 parent 53b96df commit b4d8208
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions frigate/events/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ def expire_clips(self) -> list[str]:

events_to_update = []

for batch in query.iterator():
events_to_update.extend([event.id for event in batch])
for event in query.iterator():
events_to_update.append(event)

if len(events_to_update) >= CHUNK_SIZE:
logger.debug(
f"Updating {update_params} for {len(events_to_update)} events"
Expand Down
3 changes: 2 additions & 1 deletion web/src/hooks/use-overlay-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { usePersistence } from "./use-persistence";
export function useOverlayState<S>(
key: string,
defaultValue: S | undefined = undefined,
preserveSearch: boolean = true,
): [S | undefined, (value: S, replace?: boolean) => void] {
const location = useLocation();
const navigate = useNavigate();
Expand All @@ -15,7 +16,7 @@ export function useOverlayState<S>(
(value: S, replace: boolean = false) => {
const newLocationState = { ...currentLocationState };
newLocationState[key] = value;
navigate(location.pathname + location.search, {
navigate(location.pathname + (preserveSearch ? location.search : ""), {
state: newLocationState,
replace,
});
Expand Down
7 changes: 5 additions & 2 deletions web/src/pages/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ export default function Events() {

const [showReviewed, setShowReviewed] = usePersistence("showReviewed", false);

const [recording, setRecording] =
useOverlayState<RecordingStartingPoint>("recording");
const [recording, setRecording] = useOverlayState<RecordingStartingPoint>(
"recording",
undefined,
false,
);

useSearchEffect("id", (reviewId: string) => {
axios
Expand Down

0 comments on commit b4d8208

Please sign in to comment.